syntax error

G

Guest

I am getting a syntax error on this statement
Dim strSQL As String

strSQL = "INSERT INTO " & Genetic_ID_number & " ([" & geneticIDnum & "])
SELECT " & RandomNum & " AS RandomNum;"
CurrentDb.Execute strSQL

What I am trying to do is to insert a RandomNum into the Genetic_ID_number
table field geneticIDnum.

What is the problem with this statement
 
D

Dirk Goldgar

pokdbz said:
I am getting a syntax error on this statement
Dim strSQL As String

strSQL = "INSERT INTO " & Genetic_ID_number & " ([" & geneticIDnum &
"]) SELECT " & RandomNum & " AS RandomNum;"
CurrentDb.Execute strSQL

What I am trying to do is to insert a RandomNum into the
Genetic_ID_number table field geneticIDnum.

What is the problem with this statement

The table is named "Genetic_ID_number" and the field in the table is
named "geneticIDnum"? You want to insert one record with a value for
[geneticIDnum] taken from the variable RandomNum? Try this:

strSQL = "INSERT INTO Genetic_ID_number (geneticIDnum) " & _
"VALUES (" & RandomNum & ");"
 
G

Guest

worked perfect thanks for the help

Dirk Goldgar said:
pokdbz said:
I am getting a syntax error on this statement
Dim strSQL As String

strSQL = "INSERT INTO " & Genetic_ID_number & " ([" & geneticIDnum &
"]) SELECT " & RandomNum & " AS RandomNum;"
CurrentDb.Execute strSQL

What I am trying to do is to insert a RandomNum into the
Genetic_ID_number table field geneticIDnum.

What is the problem with this statement

The table is named "Genetic_ID_number" and the field in the table is
named "geneticIDnum"? You want to insert one record with a value for
[geneticIDnum] taken from the variable RandomNum? Try this:

strSQL = "INSERT INTO Genetic_ID_number (geneticIDnum) " & _
"VALUES (" & RandomNum & ");"

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Top