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

Error 3146 Running SQL statement to connect to Oracle Database

Status
Not open for further replies.

nimrod44

Programmer
Sep 17, 2001
7
0
0
US
I am using VB6 connecting to Oracle 8.0.5 database via DAO trying to select data that will be inserted into local database (oracle lite), but keep getting an error 3146: ODBC Call--Failed when trying to select the data. I have changed the original program to include dialog box that gives the user option to select a specific type of order, ie. Open, Closed, Archived.
The original SQL statement is;
strSQL = "SELECT status, " & _
"projectNumber, " & _
"customerNumber, " & _
"customer, " & _
"Office, " & _
"CheckOutBy " & _
"FROM Project " & _
"ORDER BY projectNumber"
Set rsProjects = ObjServerCon.OpenRecordset(strSQL, dbOpenDynaset)
'This runs fine and I get all projects from the database


I have changed the original code to add a variable (strFiltName1) set by user via radio buttons on dialog box;

strSQL = "SELECT status, " & _
"projectNumber, " & _
"customerNumber, " & _
"customer, " & _
"Office, " & _
"CheckOutBy " & _
"FROM Project " & _
"WHERE Status LIKE " & strFiltName1 & _
" ORDER BY projectNumber"
Set rsProjects = ObjServerCon.OpenRecordset(strSQL, dbOpenDynaset)
The variable strFiltName1 shows the user selected variable correctly, but I keep getting the error.
If I'm leaving out any information please let me know.
Thanks,
Darrel
 
You might try to changing the line:
"WHERE Status LIKE " & strFiltName1 & _
to:
"WHERE Status LIKE '" & strFiltName1 & "'" &_
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top