PRB: Error 13 (Type Mismatch) & Error 3061 w/ SQL QueriesID: Q105171
|
Incorrect SQL syntax can cause either of the following error messages:
The SQL syntax is incorrect.
Correct the SQL syntax. See the examples in the Steps to Reproduce Behavior section below.
Control Property Value Set
------------------------------------------------------
Data1 DataBaseName C:\VB\BIBLIO.MDB
Data1 RecordSource Authors
Sub Command1_Click ()
data1.RecordSource = "Select * from authors where author = 4"
data1.Refresh ' This gives the type mismatch error
End Sub
NOTE: If you change the SQL query to the following, you will receive
the 3061 error (1 parameter expected but only 0 were supplied):
data1.RecordSource = "Select * from authors where author = brown"
The following query corrects the SQL syntax. It should work correctly
without giving an error:
data1.RecordSource = "Select * from authors where author = 'brown'"
Sub Command2_Click ()
Dim db As database
Dim ds As dynaset
Set db = OpenDatabase("C:\VB\BIBLIO.MDB")
sqlquery1$ = "Select * from authors where author = 4"
Set ds = db.CreateDynaset(sqlquery1$) 'Gives type mismatch error
End Sub
NOTE: If you change the SQL query to the following, you will receive
the 3061 error (1 parameter expected but only 0 were supplied):
sqlquery1$ = "Select * from authors where author = brown"
The following query corrects the SQL syntax. It should work correctly
without giving an error:
sqlquery1$ = "Select * from authors where author = 'brown'"
Additional query words: 3.00
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: June 25, 1999