Click to See Complete Forum and Search --> : Extracting Access data using VB 5.0


met12
June 3rd, 2004, 09:23 PM
Trying to pull a match from access table acclabel using VB 5.0.
Getting a Block error message on the Set rst line. Anyone see what is wrong?

Thanks,
met12




Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim MyStr As String

MyStr = "1212"

Set dbs = OpenDatabase("c:\vb\invenVB.mdb")
Set rst = dbs.OpenRecordset("Select AccountName from acclabel Where 4digitCode = '" & MyStr & "'", dbOpenDynaset)
MsgBox "The AccountName is: " & rst.Fields(0).Value

hspc
June 4th, 2004, 04:01 AM
-what is the error message you got ?

-did you try to run the query in access to check if it's working or not ?
try running this query :
Select AccountName from acclabel Where 4digitCode ='1234'

-what is the type of 4digitCode field ?