Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Location
    Beaverton, OR
    Posts
    4

    Unanswered: Access VB dumb questions...

    So, I haven't done anything with VB in Access for a long time, and I am rather rusty. I need to program Access so that it adds (appends) a character (a specific character, based upon one of 10 different tables) to a field in the main table, if the identification number is present in the other linked table. It's rather confusing, but what it boils down to is this, I have the following code (I may be going about this all wrong):

    Dim db As Database
    Set db = CurrentDb
    Dim group_id As String
    group_id = "B"

    While (Not (CurrentDb.[Main Table].EOF))
    If (db.[First Comparison Table].linked_field = db.[Main Table].linked_field) Then
    group_id = group_id + "C"
    Else: group_id = group_id

    Then I repeat the if statement for each of the comparison tables.

    My problem is this:every time I attempt to compile this, I get a "Method or data member not found" error, and it highlights the first instance of .[First Comparison Table]. What am I missing???

    Thanks,

    Kathie

  2. #2
    Join Date
    Feb 2004
    Location
    Canada
    Posts
    133
    Quote Originally Posted by goodkat
    So, I haven't done anything with VB in Access for a long time, and I am rather rusty. I need to program Access so that it adds (appends) a character (a specific character, based upon one of 10 different tables) to a field in the main table, if the identification number is present in the other linked table. It's rather confusing, but what it boils down to is this, I have the following code (I may be going about this all wrong):

    Dim db As Database
    Set db = CurrentDb
    Dim group_id As String
    group_id = "B"

    While (Not (CurrentDb.[Main Table].EOF))
    If (db.[First Comparison Table].linked_field = db.[Main Table].linked_field) Then
    group_id = group_id + "C"
    Else: group_id = group_id

    Then I repeat the if statement for each of the comparison tables.

    My problem is this:every time I attempt to compile this, I get a "Method or data member not found" error, and it highlights the first instance of .[First Comparison Table]. What am I missing???
    Are you using a version of Access newer than '97? If so, it sounds like your error is caused by a missing reference to the DAO object library. In the code window, go to Tools/References and make sure Microsoft DAO 3.6 object library is checked.
    Then in your code, change
    Dim db as Database
    to
    Dim db as DAO.Database
    I'm not sure about the rest of your code but you may want to read up on using recordsets.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •