MSComm Timeout

Posted on 2003-12-02
Last Modified: 2008-02-01

I have an VBA application that talks to a serial device, which acts as a converter and talks to another device. I would like a way for the application to timeout if it doesn't recieve a response in a certain period of time.

The trouble with the timeouts built in to mscomm (that I know of) is that they will only detect if the serial device is there when the app is transmitting, but I need to know if the third device is not responding.

Thanks and sorry if I wasn't clear enough.
Question by:Dormouse31
  • 2

Accepted Solution

mazfar earned 125 total points
ID: 9862756
I dont know if it answers your question but its a kind of work around.

Put a timer control and set it to whatever is your max waiting time at the port. Whenever you do a serial port open, activate the timer. When the specified interval passes, the timer event will fire and you can close the port (or do whatever u want to here). In the MSCOMM oncomm event, reset the counter (so as whenever you receive anything timer starts again).

I hope I was able to explain my solution.


Author Comment

ID: 9863085
I thought of the timer idea, but there isn't a timer in the VBA toolbox. How do you use a timer in a VBA App?

Expert Comment

ID: 9869740
Check this link to use timer API to replicate timer functionality in VBA.

Have a nice day.
LVL 29

Expert Comment

ID: 10212185
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered mazfar
Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 103
MsgBox 2 48
Windows Script Host failed (Access is denied.) error 6 109
Looking for VB6 code to read SQL table export it to ascii 8 33
Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

25 Experts available now in Live!

Get 1:1 Help Now