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

VB Error when opening a record set

Status
Not open for further replies.

redtoad

Programmer
Jan 28, 2002
51
US
I am attempting to open a recordset using VB 6 and Access with AD0 2.6 using the following:

Set mrsAppProd = New ADODB.Recordset
mrsAppProd.ActiveConnection = gcnMain
mrsAppProd.CursorType = adOpenKeyset
mrsAppProd.Source = "SELECT DISTINCT Inventory.Inv_itemname FROM( Inventory INNER JOIN ApprovedProduct ON Inventory.Inv_itemID = ApprovedProduct.AppProd_itemID) INNER JOIN Customer ON ApprovedProduct.AppProd_customerID = Customer.Cust_customerID Where Customer.Cust_customerID = " & gstrCustomerID

mrsAppProd.Open

I am getting a run time error that reads:

Visual Basic Error - 2147217900 Syntax error (missing operator) in query expression...

I've run the query in Access and it works fine.

Any help would be appreciated.
 
I found the error, I was missing a space before a quote in a line break.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top