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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Data in Access through COM Port from weigh scale

Status
Not open for further replies.

JSD1976

Programmer
Aug 17, 2004
16
US
Hello,

I am trying to send and receive data between MS Access and a weigh scale. I am using a liitle code that calls a dll file to send ASCII characters to the scale. This works fine. However, I also am trying to receive data from the scale. Sending the number one and a carriage return triggers the scale to send the displayed weight value back to the computer. I know it sends because a confirmation displays on the scale when I send it <49,13>. I figure I need to specify in Access or the dll file where to send this info. Any ideas on how to do this? I have attached the code in the form I'm using to send the data to the scale. Any help with this would be extremely appreciated.

Option Compare Database
Private Declare Function SER_OPEN& Lib "SERSEN04.DLL" (ByVal commPort&, ByVal baudRate&)
Private Declare Function SER_CLOSE& Lib "SERSEN04.DLL" ()
Private Declare Sub SER_SEND Lib "SERSEN04.DLL" (theString$)
Private Declare Sub SER_RAWSEND Lib "SERSEN04.DLL" (theString$)
Private Declare Function SER_VERSINFO$ Lib "SERSEN04.DLL" ()

Private Sub Command1_Click()

' Code for the "Send" button.
Me!Text1.SetFocus
Call SER_OPEN(1, 9600)
SER_SEND (Text1.Text)
Call SER_CLOSE

End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

'Code for the "Version" button.
Me!Text1.SetFocus
Me!Text1.Text = SER_VERSINFO$()

Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub



Thanks

Jeremy
 
Hallo,

Sounds like you need a SERREC04 DLL or something like that.
I don't suppose opening a file with the name COM would work?

- Frink
 
I used to do this a long long time ago with quick basic. I believe this was using an ON Comm statement to watch the serial port for data. I'm sure its changed by now, so I looked around and it looks like MSCOMM32 is the trick. Do a search for this.

Hope it helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top