Link to home
Start Free TrialLog in
Avatar of jbutterfieldAtDiamond
jbutterfieldAtDiamond

asked on

Run-Time Error '8021' with MSComm

Hi all,
   I currently am using two MSComm object to read from two serial ports. One is connected to a barcode reader and the other to a weigh scale.

After running for some time i recieve an

Run-Time Error '8021'
Internal error retrieving device control block for the port.

I am not sure why i am getting it and can't seem to find any way to solve the problem. Has anyone run into this problem before? I will be happy to post sections of the source code if necessary.

Thanks Much.
Avatar of edwardiii
edwardiii

Hi, jbutterfieldAtDiamond.

Hopefully an Expert with experience will post a better answer, but possibly the direction at this URL is the way to go:
     http://www.mp3car.com/vbulletin/showpost.php?p=138304&postcount=82

E.g. set up an error trap to reset the comm port to your devices?  
Avatar of jbutterfieldAtDiamond

ASKER

Hi Edwardiii,
Thanks for the idea but this really isn't an option for me becuase each time i close and reset, because of this error, i miss a box. This is an automated system and any missed packages can spell disaster. Of course i have error trapped the condition already but i would like to find a solution to this one.. i am def. stumped.

I should mention that i the client pc is a Windows XP SP 2 with a SIIG PCI two port serial card and two NIC cards installed. One NIC is onboard, the other is a PCI card. The comptuer also has an onboard serial port we are not using.

Justin.
Ok.  One last thought--if you preface your routine with "On Error Resume Next", does the MSComm force a re-acquisition of the control block, with no loss of data?
Once the error occurs the program locks up... so i can't image a resume next would work... but i will give it a shot.

If you have any other ideas that would be great. I would rather fix the problem rather than bypass it like this.. ya know.
Understood:)  I just wanted to present the Resume Next because I've run into various coding through time that throws an error and Resume Next enables processing to continue with no loss of data.  
ASKER CERTIFIED SOLUTION
Avatar of edwardiii
edwardiii

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can u please  post the code and mark the position where u get the error ?