Results 1 to 5 of 5

Thread: updating a field in Access 2003

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    updating a field in Access 2003

    This looks so simple, but duH.

    I have 2 tables New-Products and Products-List, they both have a field called Codes in them

    In the update form I have a field that uses a combobox of "Items" from Products-List, when the user selects an item, it triggers an AfterUpdateEvent.
    this is where I have trouble, how do I get the selected "Codes" value from Products-List table to update the "Codes" field in New-Products???

    I tried this, but get errors... "Can't find the field '|' referred to in expression.

    Private Sub Product_AfterUpdate()

    [New-Products]![Codes] = [Product-List]![Codes]

    End Sub

    thanks,

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: updating a field in Access 2003

    Can't really tell from that little bit of code. It looks like you are trying to reference by the names in the database like you would in a query but if you are trying to update 1 recordset with the value from another you must reference the recordset object by the name of the recordset and loose the []s

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Re: updating a field in Access 2003

    this is not done with recordsets or commands, this is done in a macro, so according the to samples I have seen it is done like what I showed, but obviously not quite.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: updating a field in Access 2003

    Oh, Sorry then, I have never actually worked with macros in Access for this type of thing. I have worked with Access quite a lot over the years but I always do my coding in VB and use Access as a data storage container.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: updating a field in Access 2003

    Thread moved from the 'VB6' forum to the 'Office Development/VBA' forum (while VBA and VB6 have some similarities, they are not the same thing)

Posting Permissions

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



Click Here to Expand Forum to Full Width