How to create new record

  • Thread starter Thread starter Tim McGavin
  • Start date Start date
T

Tim McGavin

How can i use code to create a new record into a table.

Something like this?

CreateNewRecord("John","Smith")

I tried to Google it but i can't seem to find the answer.

help!
thanks
 
How can i use code to create a new record into a table.

Something like this?

CreateNewRecord("John","Smith")

I tried to Google it but i can't seem to find the answer.

help!
thanks

Open a Recordset based on the table and use the AddNew method. See the online
help for OpenRecordset and AddNew in the VBA editor.

John W. Vinson [MVP]
 
Tim said:
How can i use code to create a new record into a table.

Something like this?

CreateNewRecord("John","Smith")

I tried to Google it but i can't seem to find the answer.

help!
thanks

Is there something you don't like about forms? Or a reason they won't
work for you?

Look up DoCmd.RunSQL in the help.
Or CurrentDB.Execute strSQL (where strSQL is a valid SQL statement)
or you could use a recordset...

Where are you trying to insert the record from?
 
Look up DoCmd.RunSQL in the help.
Or CurrentDB.Execute strSQL (where strSQL is a valid SQL statement)
or you could use a recordset...

Where are you trying to insert the record from?

Thanks guys your comments helped so much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top