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!

Using Access to Send/Receive Data Through a Com Port

Status
Not open for further replies.

JSD1976

Programmer
Aug 17, 2004
16
0
0
US
Hello,

I have encountered a problem. I am trying to understand how to get MS Access to send and receive data (numbers) to a weight scale. The scale has been programmed to accept ASCII codes. The scale has also been programmed to send out a count of units after a 2 second delay. I've tried some things, but no success. How does one open a port and send data to this scale, as well as receive data?

Any point in the right direction will be helpful

Thanks

Jeremy
 
I do not know how this works, but this is some code I picked up from a program I am debugging. Maybe it will help you somewhat.

Code:
Public Function GetWedgeData(lt)
On Error GoTo ErrHandler

    Dim ChannelNumber, X
    On Error Resume Next
    ChannelNumber = DDEInitiate("winwedge", "com1")
            If err > 0 Then
                ChannelNumber = Shell("c:\winwedge\winwedge.exe c:\winwedge\bakery.sw1")
                ChannelNumber = DDEInitiate("winwedge", "com1")

        On Error GoTo 0
        X = Now() + TimeValue("00:00:02")
        Do While Now < X
        DoEvents
        Loop
        AppActivate "wedge", True
        End If
    ChannelNumber = DDEInitiate("winwedge", "com1")
    DDEExecute ChannelNumber, "[send(" & lt & Chr(13) & ")]"
    DDETerminate ChannelNumber

ErrExit:
 Exit Function
 
ErrHandler:
 MsgBox err.Number & "  : " & err.Description, vbCritical, "Error Occurred! "
 GoTo ErrExit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top