Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL statemetn syntax error

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Hi i'm using an access db and am getting this error, but i can't see what i did wrong, any ideas? thanks

Select [_BlogBook].MarkerID, [_Marker].MarkerLable FROM [_BlogBook] JOIN [_Marker] ON [_Marker].MarkerID = [_BlogBook].MarkerID Where [_BlogBook].BlogBookID=35


using it like so:

Set RS = Conn2.Execute("Select [_BlogBook].MarkerID, [_Marker].MarkerLable FROM [_BlogBook] JOIN [_Marker] ON [_Marker].MarkerID = [_BlogBook].MarkerID Where [_BlogBook].BlogBookID="&Request.QueryString("c"))

If Not RS.EOF Then
MN=RS("MarkerLable")
End If



Thanks again.
 
What error are you getting?

It could be a number of things that we can't see in your post.

[monkey][snake] <.
 
tester...

change your code to

Code:
strSQL = "Select [_BlogBook].MarkerID, [_Marker].MarkerLable FROM [_BlogBook] JOIN [_Marker] ON [_Marker].MarkerID = [_BlogBook].MarkerID Where [_BlogBook].BlogBookID="&Request.QueryString("c"))

Set RS = Conn2.Execute(strSQL)

Response.write(strSQL) [red] 'this line will output the sql string to screen and you can then check for syntax or copy and paste it into an Access Query so that it points to where the syntax error may be. [/red]

If Not RS.EOF Then
   MN=RS("MarkerLable") 
End If

HTH
Mych



 
Chris... sorry yes you are right... brain slower than fingers!
 
ooopsie...disregard....cleverly disguised in the title<grin>

to add to mych debug approach...

Code:
iC = Request.QueryString("c")

If Len(iC) > 0 Then
 If isNumeric(iC) Then
  iC = CINT(iC)
  strSQL = "Select [_BlogBook].MarkerID, [_Marker].MarkerLable " & _
           "FROM [_BlogBook] " & _
           "INNER JOIN [_Marker] " & _
           "ON [_Marker].MarkerID = [_BlogBook].MarkerID " & _
           "WHERE [_BlogBook].BlogBookID=" & iC & "))

  ' sql debug..uncomment when needed
  '  Response.Write(strSQL) 
  '  Response.End 

    Set RS = Conn2.Execute(strSQL)


  If Not RS.EOF Then
   MN=RS("MarkerLable") 
  End If
 End If
End If
 
crapola...perhaps the culprit is the closing paren on the select ...man o man where is the editing button?...sorry to butcher the thread
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top