Dim cn
Dim strConn
Dim rs
Dim strQuery
Dim f, strFields
Set cn = CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\Shadi\Desktop;" & _
"Extended Properties=dBase IV;"
cn.Open strConn
Set rs = CreateObject("ADODB.Recordset")
strAnswer = InputBox("Please enter the bar code:", _
"Search")
strQuery = "SELECT * FROM fursan.dbf WHERE BAR_CODE = '" + strAnswer + "'"
rs.CursorLocation = 3
rs.Open strQuery, cn, 3, 3
For Each f In rs.Fields
strFields = strFields & f.Name & vbCrLf
Next
'MsgBox strFields
With rs
MsgBox "Full Name: " & .Fields("FULL_NAME").Value
MsgBox "Card_ID: " & .Fields("CARD_ID").Value
MsgBox "PRN_STATE: " & .Fields("PRN_STATE").Value
MsgBox "BARCODE: " & .Fields("BAR_CODE").Value
'.Fields("PRN_STATE").Value = " "
'.Update
End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing