Adding record to a table

Nenya

Registered User.
Local time
Today, 19:56
Joined
Jul 4, 2003
Messages
20
I need a way to create new records in a table using code.
Anyone can tell me how?
Is using ms jet with recordsets the only way? (i don't have it:( )
 
Try this:

dim MyDB as Database
dim RS as Recordset

set MyDB = CurrentDb
set RS = MyDB.OpenRecordset("MyTbl")

RS.AddNew
RS!Field1 = Val1
RS!Field2= Val2
RS.Update
RS.close

Good luck

Greg
 
Last edited:
Yay! it works!

Thx a lot :rolleyes:
 
Sdyman said:
Try this:

dim MyDB as Database
dim RS as Recordset

Just to be safe:

Dim MyDB as DAO.Database
Dim RS as DAO.Recordset
 

Users who are viewing this thread

Back
Top Bottom