Can anyone tell me what is wrong with this please? (Expected: end of statement)

whitelockben

Registered User.
Local time
Today, 22:17
Joined
Jun 29, 2011
Messages
25
Mysql = "SELECT Max(CDbl(Mid([YouFieldName]," & X & "))) AS NewNum"
FROM tbl_YourTblName Where YourFieldName Like '" & sPrefix & "*'"

I get the error highlighted at Where

The error I get is

Compile error:

Expected: end of statement.


Can anyone help please?
 
In VBA you use an "_" (underscore) as a line continuation character, so I would typcially write that sql as ...
Code:
sql = _
  "SELECT Max(CDbl(Mid([YouFieldName]," & X & "))) AS NewNum " & _
  "FROM tbl_YourTblName " & _
  "WHERE YourFieldName Like '" & sPrefix & "*'"
Does that make a difference?
Your field names are also spelled differently, which may pose a problem too.
Mark
 

Users who are viewing this thread

Back
Top Bottom