ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Another Syntax Problem (https://www.excelbanter.com/excel-programming/284162-another-syntax-problem.html)

Sharlene England

Another Syntax Problem
 
' .CommandText = Array( _
' "SELECT MILLINFO.PROJ_NAME, MILLINFO.PROJ_DIV, MILLINFO.PROJ_STLOC,
MILLINFO.PROJ_ADDRS, MILLINFO.PROJ_LOC, MILLINFO.PROJ_PROV,
MILLINFO.PROJ_POST" & Chr(13) & "" & Chr(10) & "FROM
`K:\DATA\DBDATA\JOBDATA`\MILLINFO.DBF MILLINFO" & Chr(13) & "" & Chr(10) &
"WHERE (MILLINFO.CUSTCODE='FCA')" _
' )


The above line is a part of a macro that I am writing. I need to substitue
the 'FCA' for a cell reference in my worksheet.

It keeps saying Type mismatch. Can't quite get the correct syntax.

Any help would be greatly appreciated.

Thanks in advance.



Tom Ogilvy

Another Syntax Problem
 
"WHERE (MILLINFO.CUSTCODE='" & Range("B9").Value & "')"

Note the single quotes included in the the strings on either side of the
cell reference.

--
Regards,
Tom Ogilvy


"Sharlene England" wrote in message
...
' .CommandText = Array( _
' "SELECT MILLINFO.PROJ_NAME, MILLINFO.PROJ_DIV,

MILLINFO.PROJ_STLOC,
MILLINFO.PROJ_ADDRS, MILLINFO.PROJ_LOC, MILLINFO.PROJ_PROV,
MILLINFO.PROJ_POST" & Chr(13) & "" & Chr(10) & "FROM
`K:\DATA\DBDATA\JOBDATA`\MILLINFO.DBF MILLINFO" & Chr(13) & "" & Chr(10) &
"WHERE (MILLINFO.CUSTCODE='FCA')" _
' )


The above line is a part of a macro that I am writing. I need to

substitue
the 'FCA' for a cell reference in my worksheet.

It keeps saying Type mismatch. Can't quite get the correct syntax.

Any help would be greatly appreciated.

Thanks in advance.





Sharlene England

Another Syntax Problem
 
Thanks again Tom, that was exactly the help I needed.

Sincerely,

Sharlene England




All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com