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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement in Excel VBA to Access Database

Status
Not open for further replies.

comconrk

Programmer
Jul 15, 2002
55
I have been using a simple select statement in a VBA macro

querystring = _
"SELECT Project_Number,Desc,Designer,Product_Type,On_Sale_Date,Product_Code,Pages FROM Filemaker WHERE (Project_Number=" & Proj_Truncated & ")"

It has been working very well until now, when the Project_Number has now been changed from numeric to alpha in the Access database. When I did an Excel Query and looked at the SQL code I did see that it put single quotes around the Project Number. However, that does not seem to work when I use the above statement. Since it has been working well, I am not certain what to do from here. I would appreciate any help.

Thanks very much
 
When you say you added the single quotes to the project number you mean:

WHERE (Project_Number= '" & Proj_Truncated & "' )"

Right?
 
I actually embedded the single quotes in Proj_Truncated, so
445566 now is '445566'.
 
Hrm, I thought Proj_Truncated was an integer or something. Perhaps hardcoding it like I suggest may help?? (You never know sometimes..)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top