Search results

  1. A

    Obtain List of Tables in Remote dB

    Here's an example, written in Access 97 VBA, which connects to an SQL Server back end, reads the name of each back end table, and displays each name in a message box. See the help screens for details on the arguments for the CreateWorkspace and OpenDatabase methods Dim wrk As Workspace, dbs As...
  2. A

    Format(DateAdd) question- can I subtract?

    The DateValue function returns a value of type Date corresponding to the date or time indicated in its argument. It's useful if you have a field or variable of type Date and you want to compare its value to a String, say "05/06/02". A Date value cannot be meaningfully compared to a String...
  3. A

    Proper Names

    What you're talking about is how you construct the value to be inserted into the key field, not a calculated field. Using something like Left$([Surname], 4) & Left$([Forename], 2) should work fine, assuming the resulting expression is always unique. All this is independent of whether you are...
  4. A

    Conditional Lookups

    Switch your form to Design view, select Combo1, display the Properties window, select the Event tab, click in the white space to the right of After Update, then click the little button with the three dots that appears at the end of the white space. A Choose Builder dialog box will appear...
  5. A

    Imortiing into excel with access

    You can automate this process by using either the TransferText action in a macro or the TransferText method in VBA code. The Transfer Type should be set to Import Delimited. If your tab-delimited file is not imported properly, you may also need to set up an Import Specification which indicates...
  6. A

    Importing Excel

    You can use either the TransferSpreadsheet method or the TransferSpreadsheet action to import spreadsheet contents into a table, and they both provide a Range argument that lets you limit the import to a particular range of the spreadsheet. I'm not sure if you can specify a non-existent table...
  7. A

    Distributing database subsets

    Export each client's record to a separate Excel workbook, send that to the client for updates, then import the modified workbook back into the appropriate table record.
  8. A

    Proper Names

    Use the StrConv function to convert to do the text conversion. Strictly speaking, calculated fields are available only in queries, forms and reports, not tables. However, you may be able to accomplish the same thing by using an expression in the DefaultValue property of a table field (whether...
  9. A

    Conditional Lookups

    Assuming that the fields in question are combo boxes, you can put code in the After_Update event procedure of the first combo box which changes the RowSource property (and if necessary the RowSourceType property) of the second combo box, based on what value was selected in the first combo box...
  10. A

    Store Deleted Files in A Different Table

    Set up an append query, which appends the currently displayed record to another table, along with the date and time (use the Now() function), the user name, and whatever else you want. Set up a delete query, which deletes the currently displayed record. For both queries, limit their operation...
  11. A

    Duplicate field from one record to the next

    Assuming you only want the values to carry over when you're entering new records, try something like this: Dim Hold1 as String, Hold2 as String 'module level variables ... Private Sub Form_AfterUpdate Hold1 = txtField1 Hold2 = txtField2 End Sub ... Private Sub Form_Current If Me.NewRecord Then...
  12. A

    Format(DateAdd) question- can I subtract?

    You can use DateAdd to generate dates in the future or the past, by making the second argument either positive or negative - see the help screen for more details. If you're trying to select records where the value of a particular field falls within the last two months, try something like this...
  13. A

    Recordset from a Recordset

    I'm not sure if you can use one recordset in the SQL statement that defines a second recordset. If so, great. If not, try duplicating the first recordset as a query, and then name the query in the SELECT statement.
  14. A

    Unbound combo box value

    Either Me!cboBox.Value, or simply Me!cboBox, should reference the current value in the combo box, UNLESS: 1. the combo box is in the process of being edited (you've changed the selection but haven't yet moved the focus away from the combo box); or 2. you've misspelled the name of the combo box...
  15. A

    Do...Loop

    OK, I see what you're doing. As I suspected, Or works while And does not because Or expresses the correct logic for your problem. You want to keep looping as long as EITHER the year or the period (or both) don't match - you don't want to stop if only one matches. If you change the Or to an...
  16. A

    Do...Loop

    Again, what does "doesn't work" mean? Is the loop terminating too soon (excluding cases that should be included), or does it not terminate soon enough (including cases that should be excluded), or what? I can't tell you any more without knowing what specific logic the loop is supposed to...
  17. A

    Do...Loop

    You didn't specify exactly what you mean when you say that one way works and the other one doesn't (e.g., are cases that should be excluded being included, are cases that should be included being excluded, both, etc.?). However, it may just be that Or matches the correct logic for your...
  18. A

    Save variable from Dlookup to field?

    In Access 2000, instead of DIMming dbs and rst as Database and Recordset variables, respectively, you must DIM them both as Variants. Beyond that, I'm not sure what differences are needed for Access 2000 or XP - I avoid using those versions unless absolutely necessary.
  19. A

    adding value from one form to another

    You can save the value in a text box either by assigning it to a table field before leaving the record or closing the form, as in: MyTableField = MyUnboundTextBox or, by binding the text box (setting its ControlSource property) to one of the fields in the table to which the form is bound. If...
  20. A

    If .. Then .. Else Against All Records

    One way to do this is to simply put your error-checking code in the form's BeforeUpdate event procedure. If the record is not correctly filled in, display a message box and set the Cancel argument to True (which will cancel the update and allow the user a chance to correct the problem). That...
Back
Top Bottom