471,873 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

adding new record using VBA into existing access database

Hello guys, I'm new to VBA and trying to create a form for inserting new records into an existing access database, the thing is the database is provided by a third party so I don't have control over it's fields specification. there's already 26705 rows I'd like the insertion of new records to continue in the same sequence, that's the code I've used:
Private Sub Command19_Click()

Dim dbConf As DAO.Database
Dim rstNew As DAO.Recordset

Set dbConf = CurrentDb
Set rstNew = dbConf.OpenRecordset("N-MATTE")

rstNew("DATE").Value = Me.txtDate.Value
rstNew("CLIENT").Value = Me.txtClient.Value

End Sub
Sep 18 '16 #1
2 968
To be more specific, I would like the record id to be auto-generated without having to add it by the form.
Sep 18 '16 #2
Hi 5236

If you declare an auto number field on a table, this field increments itself automatically when you add a record on this table. Nothing to do.
Sep 19 '16 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Jon S via DotNetMonster.com | last post: by
14 posts views Thread by SimeonD | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.