I am working on pulling information from a table into a Check In & Out form. We will be cataloging helmets using barcodes. With the way I have the form set up, scanning a barcode will automatically display the information for that helmet. Each helmet will then be timestamped when it is shipped out and again when it is returned. Below is the code I have so far.
Private Sub Search_Button_Click()
Dim rst As DAO.Recordset
Dim strsql As String
strsql = "Select\* From Helmets Where UPC Code = " & _
txt.ScanUPCCode.Value & ""
Set rst = CurrentDb.OpenRecordset(strsql)
If rst.EOF Then
MsgBox "No data found"
txt.ScanUPCCode.Value = Nothing
txt.HelmetID = Nothing
txt.School = Nothing
Else
txt.HelmetID.Vaule = rst.Fields("HelmetIDNumber")
txt.School.Vaule = rst.Fields("School")
End If
rst.Close
Set rst = Nothing
End Sub
txt.HelmetID.Vauleis clearly a typo. After you've fixed those issues, run your code and tell us exactly what the error is, and on which line of your code. FYI you do not clear a text box by assigningNothingto it - that is for object references. Likely you want something liketxt.School = ""strsql = "Select * From Helmets Where UPC Code = '" & txt.ScanUPCCode.Value & "'"