MS ACCESS 2002 - SQL Problems

  • Thread starter Thread starter Zenon
  • Start date Start date
Z

Zenon

Guest
Hi! First time user here! =)
I'm trying to do a simple SQL as seen below but Access keeps prompting that there is a syntax error at the FROM clause. Can anyone help to explain! Thanks!

Private Sub Command0_Click()

Dim SQL As String


SQL = "SELECT *" & _
"FROM CompletionStage" & _
"WHERE CompletionStage.Packet_No = '05-A-15315-01-5'"

DoCmd.RunSQL SQL


End Sub
 
Hey! You don't have spaces between some elements of your SQL. Try...
Code:
    SQL = "SELECT * " & _
    "FROM CompletionStage " & _
    "WHERE Packet_No = '05-A-15315-01-5'"
 
Hi Lagbolt,
Thanks for the reply. I've tried adding the spaces as you suggested but it still didn't work. Got this error -

Runtime Error ' 2342':

A RunSQL action requires an arguement consisting of an SQL statement.


:p
 
Retry

How about this:

Code:
    SQL = "SELECT * " & _
    "FROM CompletionStage " & _
    "WHERE CompletionStage.Packet_No = '05-A-15315-01-5'"
 
DoCmd.RunSQL only performs Action queries (Insert/Update/Delete)

It doesn't SELECT data. Where would it put the returned values?

You need to use a recordset.

Wayne
 
Hi all! Thanks for the suggestions so far! Going to test all of them out now! :)
 

Users who are viewing this thread

Back
Top Bottom