Hello, Thanks for looking here. Have been for VBA code to read serial port to excel for the past 3 weeks. Tried so many things that do not work in excel 2016. Need help using MSComm.ocx in MS Access 2000. I have successfully registered the file and have gotten passed licensing issue. However, I am not sure how to use the control to read the data. My code reads: mscomm1.comport = 2 mscomm1.settings = '9600,N,8,1' mscomm1.portopen = true mscomm1.inputlen = 0.
This MSAccess tutorial explains how to use the Access DateSerial function with syntax and examples.
Description
The Microsoft Access DateSerial function returns a date given a year, month, and day value.
Syntax
The syntax for the DateSerial function in MS Access is:
Parameters or Arguments
- year
- A numeric value between 100 and 9999 that represents the year value of the date.
- month
- A numeric value that represents the month value of the date.
- day
- A numeric value that represents the day value of the date.
Returns
The DateSerial function returns a date value.
Applies To
The DateSerial function can be used in the following versions of Microsoft Access:
- Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
Example
Let's look at how to use the DateSerial function in MS Access:
Example in VBA Code
The DateSerial function can be used in VBA code in Microsoft Access.
For example:
In this example, the variable called LDate would now contain the value of '5/31/2004'.
Example in SQL/Queries
You can also use the DateSerial function in a query in Microsoft Access.
Removing lens Disconnect cleaner from electrical outlet. Using a screwdriver, remove the two screws as shown and lift off lens.Your cleaner requires either a 13” or 15” agitator. Should you want to replace this filter, ask for HOOVER part No. Removing and installing filter Grasp filter bag collar (A) and pull collar from tube (B).Headlight replacement What to buy This cleaner uses a 12 volt, wedge base type 912 bulb, Hoover part No. Hoover windtunnel 3 owners manual 2. When purchasing a new agitator, ask for one of the fol- lowing: 13” - HOOVER part No.
For example:
In this query, we have used the DateSerial function as follows:
This query will use the DateSerial function to construct a date based on 2004 as the year, 3 as the month, and 12 as the day values. The results will be displayed it in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.
For example:
The results would now be displayed in a column called DateValue.
Level: Intermediate
The problem:
As time marches on, every once in a while you stumble over an application that simply refuses to die because it does its job so well.
This happened to me recently when a question was posted on Experts-Exchange asking about references in an Access app and how to bring the app forward to a later version. IT was looking to upgrade Office but could not because of this app. The asker was stuck because of the way it had been written and with the original developer long gone, the path forward was not clear.
In this particular case, it was an app that had been used as part of a process to talk to a weighbridge (a scale) via an RS232 serial connection.
After a lot of back and forth, we realized there was a little more to it; a VB 6.0 program was actually doing the RS232 part and talking to the scale, then controlling Access via OLE automation to interact with a form in order to display the weight from the scale.The Access portion of the app was only being used to log and track the weights.
The user would start with the Access app, and at the point of needing a weight, the VB6 .EXE would get fired off by Access, which would then grab a reference to Access, talk to the scale, post the weight directly on a form, and then quit.
After looking at the problem a few different ways, it seemed like the best path forward was to remove the VB6 app entirely as it was just complicating things. Access can talk to RS232 devices, but this has always been achieved by using the MSCOMM32 Active-X control on a form (see https://msdn.microsoft.com/en-us/library/aa231237(v=vs.60).aspx for info on this control). Fortunately, this is one of the Active-X controls that does work well in Access (most don’t), but there’s a rub; that control was distributed with VB 6.0 and is only licensed for use with that product.
In the past when you needed to do RS232 in Access or Excel, developers would (ahem) “borrow” the MSCOMM32 control from VB 6.0. I have never heard of an issue related to this in regards to Microsoft, and it was fairly common knowledge that this was done routinely. Strictly speaking though, it violates the licensing agreement (and this is probably why the application was written the way it was). So the goal was to find a way to do it all in Access without using the Active-X control.
The solution:
Play Diabolik Lovers Video Game Roms Online! Diabolik Lovers Games can be Played in Your Browser right here on Vizzed.com. Play lovers games online. Sep 26, 2014 8229 Diabolik Lovers official website and links to play Diabolik Lovers online / offline for free, register, sign up and login page for Diabolik Lovers game or links to buy and download Diabolik Lovers game online. Below is the list of all Diabolik Lovers sites and links: Click Here to Buy Diabolik Lovers on Amazon. Diabolik lovers, diabolik lovers - Make the Lovers to kiss each other without getting noticed by others. If anyone observes, while the lovers kiss, the game gets over. In each level, fill the kissing loader as soon as possible to move on to higher levels. Sep 16, 2013 Watch Diabolik Lovers OVA online, free More free anime domains anime kiss, anime dubbed, kiss anime mobile, kissanime.ru, kissanime.to, kissanime.com, anime list.
But were there any other ways to do it? Obviously, the MSCOMM32 control itself managed to do RS232 in some fashion, so there must be a way. After some digging, it turns out you can do serial communications through the Windows API, which only makes sense when you stop to think about it. I don’t think many in the Access world are aware of this though as all the RS232 solutions I’ve seen have relied on the use of MSCOMM32.
Under Windows, doing serial I/O is no different really than working with a file. The operations are all basically the same. Out on the net, I found a few examples of VB 6.0 code where this was demoed as a proof of concept type thing giving a general outline of how it was done. There was not a lot of documentation on the code though, leaving some questions unanswered.
It took some time to dig for documentation on the overall technique as I found very little out there. But in the end, I discovered one MSKB (Microsoft Knowledge Base) article (https://msdn.microsoft.com/en-us/library/ff802693.aspx) that covered serial communications under Windows and helped tremendously in understanding what I was seeing in the code I had found.
Tip: A sad thing that has occurred in recent years is that articles like the one above have continued to disappear out of the MSKB. Many of these contain general and fundamental knowledge on the way Access, other Office products, and Windows works. But because they are often tagged as version-specific articles, they disappear when the product goes out of support. The above article was published in Dec of 1995 as part of the VB 6.0 doc set, and yet it is still relevant and useful to this very day.
Microsoft to their credit has acknowledged that this is a real problem and in the Access area, thanks to the efforts of some very dedicated people, they are trying to save as much of this content as possible from disappearing. But the tip here is; don’t count on it being there tomorrow! If you see an article that helps you and it is more than a few years old, grab a copy of it!
It took an hour or so to re-work the code, but in the end, I had a small test DB which would replace the original
VB 6.0 app and did not rely on the Active-X control.
Since VB 6.0 is so close to VBA and code is a drop-in in most cases, and that the MSCOMM32 control does work in Access, I also created a small test DB using it as well. This was mainly to serve as a double check that we were talking to the scale OK with Access alone, but it also served as a fallback solution in case we could not get the API version working right off. It wasn’t easy arranging the time to test as the scale was in production use, and the asker was 100km away from the site where the scale was, so it was important to have something that could fill the gap if needed.
Trying it out: Serial communications software windows 10.
We finally managed to arrange some time to test things and it didn’t take long to get the Active-X version working (which is what we expected). The Win API version though took a few hours to get working. That was mainly due to two things:
Can Serial Communication
- We actually didn’t know the baud rate, parity, speed, or the number of stop bits of the scale. While the original VB 6.0 source code had these values, we were not 100% sure the .EXE in use had been compiled from that source. Ultimately we determined that indeed the parameters were off. What confused us for a while is that the Active-X version appeared to work even with the wrong parameters, and I’m still scratching my head over that one. But with the Win API version, it didn’t work at all with the wrong parameters in place. After playing around a bit, we were able to determine the correct ones.
- Timing related to analyzing the data coming in. I had set a form timer for five milliseconds to check for data, and this proved to be too fast. The scale was sending weigh data in blocks of fifteen characters and five milliseconds was not long enough to transmit the full block (which I should have known based on the baud rate). After slowing down the timer, we ended up with multiple blocks and always had at least one full block of data to work with.
Sidebar: I should also note that part of the time it took to get everything working was due to the fact that while I was in the United States, the PC and scale were in Australia! I was using an older version of Team Viewer for remote control, and at times it was a bit slow, but overall it worked far better than I expected.
This was my first time doing remote work outside the US, and I was more than pleasantly surprised at how well it actually worked. I even used the VOIP (Voice Over IP) feature built into Team Viewer so the asker and I could chat while we debugged. Given that we were a half a world apart, it worked exceptionally well. Moral of the story; don’t be afraid to take on overseas projects thinking communications will be a problem. You may be very surprised (as I was) on how well you can do.
Ms Access Serial Communications
Serial Communication Basics
The result:
In the end, we ended up using the API version, so now only Access is involved in the process, which greatly simplified things. Originally in Access 2000, this app can now be brought forward into any of the more recent versions easily without issue.
Both test DB’s we used are attached in a zip file along with this article so you can see what was done. I tried to keep the code similar as possible in each so it is easy to compare the two methods. While it still could use some clean-up, it is workable in its current form and provides enough of an outline so that you can do RS232 in your own apps. I used a single form along with a single VBA code module that can be dropped into any application that needs RS232 communications capability. Note that I have not included the Active-X control in the zip file, so the Active-X version is non-working unless you have VB 6.0 installed on your PC (you may need to adjust the references in VBA).
Ms Access Serial Communication System
I would also be remiss in not acknowledging and giving thanks to David M. Hitchner, whose VB6 code I found out on the net and used as the basis for this solution. With that code, I actually had to do very little in putting this together.
Serial Communication Arduino
Enjoy!
Ms Access Serial Communication Test
Jim Dettman
Serial Port Communication
abcdefghijklmnopqrstuvwxyz