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!

I need MS Access to open a gate

Status
Not open for further replies.

Nacar

Technical User
Dec 21, 2004
21
0
0
US
Hello,
Again, I need your worthy help, please.
I am working in a project in a condo. They have a vehicle barcode reader. When the car is near, the scanner (barcode reader) reads the barcode and open de gate.
The reader can work alone, but they want to generate reports and keep some control on that.
I built an application already with the reports they need and want.
Now I need MS Access gets the control and validates the barcodes and give the signal to open (or not to open) the gate.
The reader is model BA-200 from BAi company.
Somebody told me about to open a computer port. It is to say, Access send a signal to a serial port and get the gate open.
Could you please help me on this matter?
Thank you very much.
Nacar
[sunshine]
 
here you have some code that i use to query a scale with mscomm control

msca.PortOpen = True
msca.Output = "W"
Do Until a > "" Or b = 20000
a = msca.Input
b = b + 1
Loop
msca.PortOpen = False
If b > 19999 Then
getweight = "No response from scale!"
Else
getweight = Mid(a, 2, Len(a) - 2)
End If
what do you have to send to the gate to open the gate
 
Thank you pwise for your answer.
I think your code will work but I need a little more info in VBA.
Could you please write an complete example code.
What does "msca" mean? Do I have to add some references?
Or is it a module?
Thanks for your help.
Nacar
 
i dont know how your gate works but i imagin that you have to sens a letter or word to the gate

you have to get mscommcontrol
add it to you form
msca in the name i gave my control
Code:
'open port
msca.PortOpen = True
'send message to port
msca.Output = whateveryouhaveto



'if you can get feedback from your gate

 a = msca.Input
' it might take time to get the feedback so i made a loop
Do Until a > "" Or b = 20000
    a = msca.Input
    b = b + 1
Loop
msca.PortOpen = False
hope this helps
 
Diffferent strokes for differnt folks. Answered differently in other fora. Please DO NOT CROSS POST. It makes some of the natives cross and iritable!



MichaelRed


 
pwise,
you are completely right.
You said: "the issue here is how to get access to open the gate".
When I called manufaturer they told me the reader can accept input through serial port (computers, laptops, and palm pilots!!)
But they asked me: "Can MS Access communicate with the serial port?" I do not know.
And you are right because they told me, can MS Access send letter "A" for access and letter "D", for denied to the serial port?
You put me to read about mscomm control. But where can I find that mscommcontrol added to the form? I looked at the toolbox in MS Access and the References in VBA but I cannot see it.
Thanks pwise.
Nacar
 
pwise,
I installed my VB 6.0 on my PC. After that the MSComm Control appeared in the MS Access toolbox.
Then I could use your code and it worked fine. Now I begin to understand this issue.

Private Sub Command1_Click()
'open port
MSComm0.PortOpen = True
'send message to port
MSComm0.Output = MsgBox("Hello") & "A" & Chr$(13)
MSComm0.PortOpen = False
End Sub

I inserted the MsgBox to see something on the screen.
Manufacturer told me something about carriage return.
I think I know a little bit more than this morning.
But, how can I make some live task on my computer to see the signal, something like a turn on a light, etc.

Thanks a lot!!!!
Nacar

 
Thanks pwise,
I am reading and studyig your links. I will tell you something later.
Nacar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top