Adding new record via VB code?

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I am currently using this method:

Set db = CurrentDb()
Set rst = db.openrecordset("SELECT * FROM [tblPercent]")

to access my table using VB code. I know how to manipulate
existing data by using rst.Edit, rst.Update, rst.Fields
etc.

But just say I wanted to add a new record to the end of
the table? What command would I use. I tried using
rst.NewRecord, but got an error.

Any help would be appreciated.

Thanks in advance.
 
Hi Mike,

Try rst.AddNew

(make sure you add the rst.Update at the end)
 

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