card swipe

  • Thread starter Thread starter anouska
  • Start date Start date
A

anouska

Hi,

We have a database, the start form has a text box in
which a member swipes their card in order to bring up
their record. Currently they have to swipe their card and
then click "GO" which runs a macro. What I am wondering
is there a way so they can just swipe their card and the
macro runs automatically without the member having to
click "GO" to set the macro running?

Thanks
Anouska
 
Assuming that the swipe card interface is acting like the
keyboard, and each card presents the same number of
digits/characters, you cound do something like this in the
textbox's KeyUp event

if len(txtbox.text) = 12 'Expected number of chars
docmd.runmacro "macroname"
end if

If the number of character is variable you may need to
start a timer event on the first character (say 1/2
second) and call the macro at the end of the time.
 
Thanks for that, we got the len bit working but we think
we need to have the startup form reload itself 10 sec or
so, in case someone swipes say another card by accident
and it may only have say 10 characters rather than the 12
that we have now. If so, then the 10 characters would sit
on the screen and stuff up the next card swipe. Can you
help me with this?

Thanks
Anouska
 
Anouska said:
Thanks for that, we got the len bit working but we think
we need to have the startup form reload itself 10 sec or
so, in case someone swipes say another card by accident
and it may only have say 10 characters rather than the 12
that we have now. If so, then the 10 characters would sit
on the screen and stuff up the next card swipe. Can you
help me with this?

Thanks
Anouska

I don't know much about a card swipe, but communications of
data at variable
lengths have always had some "Start of Text" and "End of
Text" control character
to tell the program the start and end of a data stream.

It sounds like you need the click button to tell the program
the user has swiped
a card. How does your program know where to get the data
from?
Instead of looking at the length of the string, you should be
looking for the start
and or end characters to control the execution of the DoCmd
for the macro.


Ron
 
Change the keyup event to

if len(txtbox.text) = 1 '1st char from card
me.TimerInterval = 3000 '3 seconds
end if
if len(txtbox.text) = 12 'Expected number of chars
me.TimerInterval = 0 'Disable timer
docmd.runmacro "macroname"
txtBox.text = "" 'remove the old card swipe
end if

add code to the form_timer event

Private Sub Form_Timer()
'Three seconds after first char ...
docmd.runmacro "macroname"
txtBox.text = "" 'remove the old card swipe
end sub
 
-----Original Message-----


I don't know much about a card swipe, but communications of
data at variable
lengths have always had some "Start of Text" and "End of
Text" control character
to tell the program the start and end of a data stream.

It sounds like you need the click button to tell the program
the user has swiped
a card. How does your program know where to get the data
from?
Instead of looking at the length of the string, you should be
looking for the start
and or end characters to control the execution of the DoCmd
for the macro.


Ron
--
Ronald W. Roberts
Roberts Communication
(e-mail address removed)
To reply remove "_at_robcom_dot_com"


.
Thanks for that Robert,

You are right, there is a start and end character. When
the card is swiped the numbers look like this:

;1254002244?
;1254002211?

There is a table with all the numbers in them, there are
about 12000 records. Can you help me with the code to do
it as you suggested? It looks like a better option. Can
the code make the page reset itself if the number does
not match the format? ie 12 characters, with a ; at the
beginning and a ? at the end?

Thanks
Anouska
 
Anouska said:
You are right, there is a start and end character. When
the card is swiped the numbers look like this:

;1254002244?
;1254002211?

There is a table with all the numbers in them, there are
about 12000 records. Can you help me with the code to do
it as you suggested? It looks like a better option. Can
the code make the page reset itself if the number does
not match the format? ie 12 characters, with a ; at the
beginning and a ? at the end?

Thanks
Anouska

Using the Left, Right, Len and Mid instructions you can test
and extract
the information you need. Chris has given you an example of
how to
write the routine. What I still don't understand is where in
your program
does the ;12345002211? show up at? also, does any Access
events
assigned to the form fire? If an event fires, you can process
the string
in that event and test to see if it is valid. If it is not,
reset the form, maybe
display a message to the use and start over.
 
Back
Top