Solved

Using MSComm in Microsoft Access 2003

Posted on 2006-12-01
6
1,546 Views
Last Modified: 2008-01-09
Hi,
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
0
Comment
Question by:rowenab
6 Comments
 
LVL 7

Expert Comment

by:mquiroz
ID: 18073797
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...
0
 

Author Comment

by:rowenab
ID: 18079049
yes, the form with the controls are open
0
 

Author Comment

by:rowenab
ID: 18090394
Hello
I figured out the problem.  My form works fine using global variables.  This question can now be closed.
0
 
LVL 3

Expert Comment

by:taycuong76
ID: 18091467
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".
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18231888
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now