Results 1 to 2 of 2

Thread: add new record in table in access

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    40

    add new record in table in access

    Hi,

    I have some troubles with code in access vb.

    Well, I made it already possible to add new records with textbox and button with the code:
    CurrentDb.Execute "INSERT INTO TblOplossingen (Oplossing) VALUES ('" & TypnieuweOplossing.Value & "')"

    Now in my TblOplossingen I have the field autonumberfield.
    So when I push on the button, the new record will be placed and also a new number in the autonumberfield.
    But this is not the only thing I want.

    When I push on the button, I want too that the autonumberfield of my new record will be added in another table. And this while the new number of the autonumberfield of my new record is not visible in the form.

    Has anybody a solution for that problem?

    greetz

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: add new record in table in access

    Since you updated via an execute, you will need to use the max function in an sql statement, possibly in another Insert Into with the max as a sub query to get the max number in the id field... Not too sure.
    The alternative is to use several recordsets to pull the information you want and write it back to the db.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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