Search results

  1. N

    Import from Excel using Import Spec

    Is there any particular reason you want to use an import specification? You can transfer a spreadsheet like thisDoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "Import Table", "C:\ExcelFile.xlsx", True, "ImportRange"where ImportRange is a named range in the file. This does not use...
  2. N

    frame option stored values

    The response to clicking an option button in a frame is the ordinal position of that button (always numeric). If you need Yes/No values to be displayed, you need to convert the numbers. If your frame is named fraTest, you need its AfterUpdate event to convert the value to what you need...
  3. N

    Open new form based on this record

    If you are opening the update form from another one, you can use the OpenArgs parameter of the DoCmd.OpenForm action to pass over the record number you want, then use DoCmd.GoToRecord acDataForm, Me.Name, acGoTo, 1234 to get the record you want (where 1234 is the offset you must calculate). I...
  4. N

    Question Haven't a clue where to start

    You could start by using one of the template databases offered in Access - NorthWind.accdb is quite useful, as number of the help texts refer to it. From Excel, you can use the Import Wizard to retrieve your spreadsheet(s) and let it analyse your columns. That will be its "best guess" and likely...
  5. N

    Proper Case function

    You need a Case Else catch-all for those controls which don't have the tag set and you can add the visibility and enabled checks to the if statement:Private Sub SetProperCase() Dim ctl As Control For Each ctl In Me.Controls 'set a property of the control based on the value 'saved in the...
  6. N

    Proper Case function

    You can always add further checks to the control being referenced, to check its visibility and enabled states. Determining the 'previous' control can be difficult - the form's tab order defines this, unless you do it by control name - which defeats the point of a generalised loop. Don't forget...
  7. N

    Proper Case function

    No reason I can think of that the event is not firing. Do other events fire OK (if you have any?). If not, have a look at Access Options > Trust Center > Trust Center settings ... and check Enable all macros (and heed the warning!). In your code, what do you expect 'If CancelPressed = True' to...
  8. N

    Proper Case function

    Try this, then:Dim ctl As Control For Each ctl In Me.Controls If ctl.ControlType = acTextBox Then ctl.SetFocus ctl.Text = StrConv(ctl.Text, vbProperCase) End If Next HTH!
  9. N

    Proper Case function

    Put it in the Form_BeforeUpdate event.
  10. N

    Proper Case function

    :eek:... oops! Should be:Dim ctl As Control For Each ctl In Me.Controls If ctl.ControlType = acTextBox Then ctl.Text = StrConv(ctl.Text, vbProperCase) Next
  11. N

    Proper Case function

    How about this?Dim ctl As Control For Each ctl In Me.Controls If ctl.ControlType = acTextBox Then ctl.Text = StrConv(Me.Text, vbProperCase) Next
  12. N

    Running a subroutine periodically

    You could put your variables into the ThisWorkbook object or a Module like this: Public RecalculateRun As Boolean Public RecalculateTime As Variant Your Recalculate sub could go here as well. If you use ThisWorkbook, you could put your Worksheet Activate/Deactivate code there as well, to...
  13. N

    Question Pointless, BUT: Trigger event when database is opened (even while holding shift)?

    Going back to your original requirement, the question is how you can be selective on what to run during development mode? In essence, there are two options: 1. External control, such as that suggested by vbaInet 2. Internal control, which is selective and tiggered by someting straight-forward...
  14. N

    Query second highest value

    I'm surprised you don't get a run-time error with this!:confused: If you deconstruct your SQL string, the embedded query returns a list of records with multiple fields (however many are in table 'Quotes'). The outer query is expecting a table name here. You need to do something like this: Set...
  15. N

    Question Pointless, BUT: Trigger event when database is opened (even while holding shift)?

    That's a shame! :mad: I can't immediately think of an alternative, but I'll sleep on it. All things are possible with persistence, I find. :)
  16. N

    Question Pointless, BUT: Trigger event when database is opened (even while holding shift)?

    Do you have a form which opens when you load the DB? If so, put your message box in the Form_Load event of that. If you don't have such a form, then make one for this purpose and delete it when your design is complete.
  17. N

    Change list in Lookup Field in Form without changing previous inputs

    In your control 'Work Code' whose Control Source is 'Project_ID', add a WHERE clause to the Row Source to restrict the lookup to only active reords. The Row Source would look like this:SELECT ID, Project_Code FROM qryProjectsActive WHERE Active=True; All other queries on the table would not have...
  18. N

    Kindly Sugesst

    You didn't answer my question about what's in fields Text1.Text and Text2.Text? In any case, I had a closer look at the error message you posted and I think I see the problem (at least in part). The error message is which is showing your two date field names as literals. the SQL statement should...
  19. N

    Clear form for next record (MS Access 2007)

    From what I can see of your code, it appears that you are working against the principles of bound forms. Your Add_Record_Click event is using SQL INSERT to add the form data to the table to which the form is bound, which is not necessary. There is no need for any DoCmd functions in your...
  20. N

    Mixed Date Formats

    From a data perspective, dates are just numbers. The presentation is down to formatting, so presumably there is a Format statement somewhere in the application which is "mm/dd/yyyy"? If so, change that to "dd/mm/yyyy" and that will fix it. I'm not entirely sure if you have contol over this -...
Back
Top Bottom