accesslevel
Registered User.
- Local time
- Today, 20:20
- Joined
- Feb 10, 2003
- Messages
- 12
Hey all
When I click a button on my form I want it to add the title, firstname and lastname from the fields on the form to my existing customers table but I am stuck when it comes to the autonumber.
I tried using:
DoCmd.RunSQL "INSERT INTO Table1 values(cboTitle.value, txtFirstname, txtLastname)" but the ID field I have in my table doesn't create its own number and the query fails
I also tried creating the ID myself:
Dim SQL As String
randNumber = Int((9999999 - 1000000 + 1) * Rnd + 1000000)
SQL = "SELECT * FROM Table1 WHERE ID = randNumber;"
DoCmd.RunSQL SQL
but it fails saying its not a valid SQL statement.
Help please
When I click a button on my form I want it to add the title, firstname and lastname from the fields on the form to my existing customers table but I am stuck when it comes to the autonumber.
I tried using:
DoCmd.RunSQL "INSERT INTO Table1 values(cboTitle.value, txtFirstname, txtLastname)" but the ID field I have in my table doesn't create its own number and the query fails
I also tried creating the ID myself:
Dim SQL As String
randNumber = Int((9999999 - 1000000 + 1) * Rnd + 1000000)
SQL = "SELECT * FROM Table1 WHERE ID = randNumber;"
DoCmd.RunSQL SQL
but it fails saying its not a valid SQL statement.
Help please
