I have written a code in VB that should do a query in Microsoft Access
and show the result in my labels in my forms.
the code is here:
Dim table_name as String
Dim sql as String
table_name = db.TableDefs(1).Name
sql = "select * from wholestuff where codestuff=" & table_name
Set rs = db.OpenRecordset(sql, dbOpenDynaset)
Label1.Caption = rs("namestuff").value
in which namestuff is the name of one of the col in wholestuff table
and codestuff is the name of one of the col in table_name table that
it paly the role of primary key in this table and it's type is Text.
but in running this code I get this error:
"Data Type Mismatch in criteria expression"