Results 1 to 6 of 6

Thread: Update Table

  1. #1
    Join Date
    Feb 2005
    Posts
    24

    Unanswered: Update Table

    I have never tried this procedure before. I have a form that is bound to a query. I would like to add a new record in a different table with some of the information on the form. The table that I want to add the record is not bound to the form. I know this can be done, but don't have a clue how to do it.

    Any help will be greatly appreciated.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    It can be done with VBA recordsets.

    I'm flogged for time atm, so I can't throw some code at you, but someone else is sure to.

    Check out "OpenRecordset" in help and see how far you can get while you wait
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Feb 2005
    Posts
    24
    I will check it out while I wait.

    Thanks

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    The following code adds a record to a specific table.

    Code:
    Dim rsTable as RecordSet
    Set rsTable = CurrentDb.OpenRecordset("SELECT * FROM TABLENAME;")
    rsTable.AddNew
    rsTable!FieldName = Value
    rsTable!OtherFieldName = OtherValue
    rsTable!AndSoOn = YetAnotherValue
    rsTable.Update
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Feb 2005
    Posts
    24
    Thanks a bunch.

    I will try it and see how it goes.

    Mike

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    No wurriez! Good luck
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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