I have recently started using SQL server again as a database for an Excel Application. Previously I was using Access. I am trying to pass a date variable to SQL and am getting a syntax error. I know in access the code would read as follows. Not sure the difference in SQL. For that matter, what is the syntax for passing strings? My code might be incorrect there as well.
strSQL1 = "Select * " _
& " From dbo.tblCredit" _
& " Where dtCreditDate = # " & dtCreditDate & " # " _
& " And numCompanyID = " & rs!numCompanyID & "" _
& " And strXOrder = '" & rs!strXOrder & "'" _
& " And strVendor='" & strVendor & "'"