Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InputBox, Delay , Magstripe Verification of Data Need Help 1

Status
Not open for further replies.

digipad

Programmer
Jun 17, 2007
7
0
0
US
I have a project where I have Text Box on a Form.

I need to verify the data from Magstripe right after it been swiped , without using any command

So I tried to use Private Sub Inputbox_Change()

When you sweipe the card, it will not wait untill all the data is in Text box, but it will display the message after the first character.

Anyone can help me with code ?

Thank you
 
If you've named your text box an Inputbox

Private Sub Inputbox_Change() event will fire after every change in the text box.

If you have a specific number of characters that the swipe will enter - let's say 17, you could do that:
Code:
Private Sub Inputbox_Change()

If Len(Inputbox.Text) = 17 Then
   ... do your logic here
End If

End Sub
If you don't, and you still want to use your Change event, put your swipe info in a label, check the lenght of the text in a label, and now that you do know the number of characters, use the code above.
Code:
Private Sub Inputbox_Change()

If Len(Inputbox.Text) = Len(InputLbl.Caption) Then
   ... do your logic here
End If

End Sub


Have fun.

---- Andy
 
Ok - so you're magstripe reader is

a) pretending to be a keyboard

b) intelligent, in that it recognizes that ? is the End Sentinel character (i.e end of field/track marker) and sends that as an Enter (which is a reasonable action for it to take).

One question: the standards for the US driving licence magstrip indicate that there should be a Start Sentinel as well (normally %) which is missing from your example data; is this correct, or have you accidentally left it out?

You might want a quick look at pages 61 thru 64 (or 65, if you want three tracks

Anyway, one method of dealing with this would be to create a custom input form of your own which simply consists of a single textbox (set to multiline) on it, and have something like the following (this is NOT a full solution, just an example):
Code:
[blue]Private Sub Text1_Change()
    Dim Tracks() As String
    Dim Track1() As String
    Dim Track2() As String
    Tracks = Split(Text1.Text, vbCrLf)
    If UBound(Tracks) = 2 Then
        Track1 = Split(Tracks(0), "^")
        Track2 = Split(Split(Tracks(1), ";")(1), "^")
        'at this point Track1 is an array containing the fields of track1, and Track2 is ... you guessed it ...
    End If
End Sub[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top