Re: Insert New Record

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"tiredoftrying" <tiredoftrying@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:42A1F62D-7373-483D-BE2F-9235B85AF8A3@xxxxxxxxxxxxx
> I need the code to insert a new record in a table that is in the same
> .mdb database that my form is in, I want a command button that on
> click will insert a record into a table called POINTS
>
> The POINTS table has 2 fields called NAME_ID and SCORE - both are
> number fields and for testing purposes I want bot to get a value of 1
> inserted when the record is created.

Here's one way:

CurrentDb.Execute _
"INSERT INTO POINTS (NAME_ID, SCORE) " & _
"VALUES(1, 1)", _
dbFailOnError

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.


Quantcast