A little help (1 Viewer)

vagelisr

Registered User.
Local time
Today, 05:02
Joined
Apr 28, 2011
Messages
87
I'm try to return some values from a record in my access database but i can't

i use this code
Code:
Private Sub Find_Desc_Quan()
    Dim con As ADODB.Connection
    Dim rst As ADODB.Recordset
    Dim sSql As String
    sSql = "SELECT * FROM Material WHERE ITEM_BARCODE= 1234567890"
    Set con = Access.CurrentProject.Connection
    Set rst = New ADODB.Recordset
    rst.Open sSql, con, adOpenDynamic, adLockPessimistic
    MsgBox rst(0)
    rst.Close
    Set rst = Nothing
    con.Close
    Set con = Nothing
End Sub

but i receive Run-time error 2147.......

Please some help because i have stack......

PS i have also upload the DB. Has only 1 record.

Thanks and regards.......
 

Attachments

  • Test_DB.mdb
    164 KB · Views: 68
Last edited by a moderator:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 03:02
Joined
Jul 9, 2003
Messages
16,280
Try:-

Code:
sSql = "SELECT * FROM Material WHERE ITEM_BARCODE = '1234567890'"
 

vagelisr

Registered User.
Local time
Today, 05:02
Joined
Apr 28, 2011
Messages
87
Thanks Uncle Gizmo.....
It work like a charm :)
 

Users who are viewing this thread

Top Bottom