Article ID: 105171
Article Last Modified on 1/8/2003
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: kbprb KB105171