SQL For Next

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could someone help me identify my error in the following SQL statement:

Public Sub DailyRun()
For x = 1 To 2
DoCmd.RunSQL "SELECT [ITNBR] into tbl1 FROM [SHANE_TRANSDATA] WHERE [UPDDT]=
X;"
Next x
End Sub

I am wanting to output ITNBR (item #) where the UPDDT (date) equals the
variable x. Please help. Thanks! Feel free to add comments, if you like.
 
DoCmd.RunSQL "SELECT [ITNBR] into tbl1 FROM [SHANE_TRANSDATA] WHERE
[UPDDT]=" & X
 
Thanks, Brendan. That did it!

Brendan Reynolds said:
DoCmd.RunSQL "SELECT [ITNBR] into tbl1 FROM [SHANE_TRANSDATA] WHERE
[UPDDT]=" & X

--
Brendan Reynolds (MVP)


SLeach said:
Could someone help me identify my error in the following SQL statement:

Public Sub DailyRun()
For x = 1 To 2
DoCmd.RunSQL "SELECT [ITNBR] into tbl1 FROM [SHANE_TRANSDATA] WHERE
[UPDDT]=
X;"
Next x
End Sub

I am wanting to output ITNBR (item #) where the UPDDT (date) equals the
variable x. Please help. Thanks! Feel free to add comments, if you
like.
 

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