jwcolby
jwcolby at colbyconsulting.com
Tue Sep 6 20:45:09 CDT 2011
# on both sides signifies a date but *only* in the Access version of SQL, not (for example) in TSQL for SQL Server. Probably you are confusing Access SQL by making it think you are trying to specify a date. John W. Colby www.ColbyConsulting.com On 9/6/2011 9:34 PM, Darryl Collins wrote: > Uh oh... I thought today was going too darn well. > > I am working with data which has "#" as part of the string which causes the > VBA code to fail > > For Example: > > gstrSQL = vbNullString > gstrSQL = gstrSQL& " SELECT" > gstrSQL = gstrSQL& " Activity," > gstrSQL = gstrSQL& " SUM(Activity_CF) AS Total_CF" > gstrSQL = gstrSQL& " SUM(Activity_DCF) AS Total_DCF" > gstrSQL = gstrSQL& " FROM ProbC_tblActivities" > gstrSQL = gstrSQL& " GROUP BY Activity" > gstrSQL = gstrSQL& " HAVING Activity="#Input" > gstrSQL = gstrSQL& " AND Total_CF<> 0" > > Which sort of makes sense as the # is used in VBA for Conditional Compile. > > Is there some way I can I get VBA to accept the # as part of the string and > not a command? > > Google has fairly useless when searching for "#" as well. Bah humbubg. > > Cheers > Darryl >