Hi,
I am trying to get this SQL query to work, but so far I haven't been getting it to. When I test this query, the debugger always stops at the recordset.open command. The error says:
-2147217900 (80040e14) Invalid Column Name
But it's not an invalid column name; it's right on. In fact, I have another subroutine with the same query except I select a few less columns and my WHERE clause is different. The other subroutine works flawlessly, this one never seems to get it. What I don't get, is why is it saying that the column name is no good, when the WHERE clause is where I'm looking for the LastName Column? I do select the LastName column, but then as a test I replaced the specific commands with a * and I still got the error. Any ideas? I would appreciate any you might have. Thanks.
'SQL query to return the customer info variables in the most recent billing cycle.
strLastNameSQL = "SELECT LastName, FirstName, AccountNumber, CustomerNumber FROM dbo.WaterUtilityMasterData WHERE LastName =" & strLastNameBox
'Opens the ADO Connection with the Connection String provided.
sqlConn2.Open "Provider=sqloledb;Data Source=PWSRV1\GISDATA;Initial Catalog=DTS_Packages;User Id=waterUSER;Password=waterUSER;"
'Opens the first recordset.
rsLastNameWater.Open strLastNameSQL, sqlConn2