+ Reply to Thread
Results 1 to 3 of 3

Adding new records

  1. #1
    jesika
    Guest

    Adding new records

    Hi,

    I have linked tables from a sql server 2005 to Access 2003. I can add any
    record manually directly into the table but I am having trouble with the "update" when I add the record from the vb code. I keep
    getting a message that ODBC---Call Failed.
    Run Time Error '3146'. Then the code breaks at ".Update".
    thanks
    Al

    Dim db As Database, rst As Recordset
    Set db = CurrentDb()
    Set rst = db.OpenRecordset("tblUserLog", dbOpenDynaset,
    dbSeeChanges, dbOptimistic)

    With rst
    .AddNew
    ![UserID] = Me![SelectUser]
    .Update
    End With
    rst.Close

  2. #2
    Forum Administrator ExlGuru's Avatar
    Join Date
    03-17-2009
    Location
    India
    MS-Off Ver
    2003,2007
    Posts
    222

    Re: Adding new records

    Jesika,

    I have changed the code slightly. When the add task button is pressed the form is supposed to collect the rest of the information for the record. The form now opens and the serial number is added to the database however the rest of the field content on the form does not save
    Please Login or Register  to view this content.
    On the Form Open of Task I have the following code

    Please Login or Register  to view this content.
    On the task form I have the following save and close button

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Adding new records

    jesika

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1