Using MSComm in Microsoft Access 2003

I have developed a POS sytem using Microsoft Access.  I am using MSComm to transmit information to a pole display, which works fine.  I have different forms that  needs to send information to the Pole Display.  I would like to work with only one form that has MSComm controls.  So,  I created a form and called it CommForm, and I called the MSComm control commpd. I created another form with a command button and I paste the attached code to it.  When I click on the command button, I get the following message: Run-time error '91' Object variable or with block variable not set.  I don't know what commands I am missing.  Can someone please help.

Private Sub Command0_Click()

If CommForm.commpd.PortOpen = False Then
    CommForm.commpd.PortOpen = True
End If

Dim s As String
s = "testing"
CommForm.commpd.Output = s

End Sub
Who is Participating?
Computer101Connect With a Mentor Commented:
PAQed with points refunded (500)

EE Admin
are you sure that the form with the control is already open when the code executes?

it seems that you're triyng to use a control that doesn't exist at runtime yet...
rowenabAuthor Commented:
yes, the form with the controls are open
rowenabAuthor Commented:
I figured out the problem.  My form works fine using global variables.  This question can now be closed.
You have to load form CommForm first, then fire it from the other form wwhich has command1 button.
MScomm control have no property nor method nor constant named "commpd".
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.