Automatic record lookup

R

Ricky

Hi everyone,

Here I am yet once again with another issue. I have a textfield that takes
input for the user. Once the user swipes the card, the textbox is
automatically filled in with the card number. I was wandering if there is a
way in access, that as soon as a card is swiped, access automatically matches
it with the customer table in the database and tries to find a match. Once a
record corresponding to the card number is found, it displays that customer's
information. Is that at all possible?
Please help

Thanks
 
J

John Vinson

Hi everyone,

Here I am yet once again with another issue. I have a textfield that takes
input for the user. Once the user swipes the card, the textbox is
automatically filled in with the card number. I was wandering if there is a
way in access, that as soon as a card is swiped, access automatically matches
it with the customer table in the database and tries to find a match. Once a
record corresponding to the card number is found, it displays that customer's
information. Is that at all possible?
Please help

Sure. Make the textbox *unbound* in your form - it should have no
Control Source. The form should be based on your customer table or a
suitable query based on the customer table.

In its AfterUpdate event, search for the card number. Air code,
untested:

Private Sub txtCardSwipe_AfterUpdate()
Dim rs As DAO.Recordset
Dim iAns As Integer
Set rs = Me.RecordsetClone
rs.FindFirst "[CardNumber] = '" & Me!txtCardSwipe & "'"
If rs.NoMatch Then
iAns = MsgBox("Card number not found; add new record?", vbYesNo)
If iAns = vbYes Then
DoCmd.GoToRecord, , acNewRecord
Me!txtCardNumber = Me!txtCardSwipe ' copy into bound textbox
Else
Me.Undo ' erase the form
End If
Else ' record found, go to it
Me.Bookmark = rs.Bookmark
End If


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top