Bob O
Aug 12 2005, 08:18 AM
Could anyone give me a shove in the right direction on how to or where to look about writing or reading an inter and a string into my ML1500 hooked up to a1761-NET-ENI. I would like to get this integer and string from my MSAccess database that is on the network.
Thanks,
Bob O.
gravitar
Aug 12 2005, 02:39 PM
| QUOTE (Bob O @ Aug 12 2005, 08:18 AM) |
Could anyone give me a shove in the right direction on how to or where to look about writing or reading an inter and a string into my ML1500 hooked up to a1761-NET-ENI. I would like to get this integer and string from my MSAccess database that is on the network.
Thanks, Bob O. |
I only played around with this capability once or twice many years ago, but I believe you must create a "hot link" with RSLinx to the data element in the micro, and then paste the hot link into the database. Come to think of it, I only tried doing this with an Excel spreadsheet but I'm assuming the processis ismilar.
Others are sure to offer more first-hand knowledge of what to do, I assume many here have tried it!
panic mode
Aug 12 2005, 04:14 PM
You could write application for PC where database resides and use ActiveX to connect to PLC.
Gerry
Aug 12 2005, 05:05 PM
Is this the same Bob O as over at PLCS.net?
If so, I presume you've got RSView32 in the mix? If so, use VBA to get the info from MSAccess and write to the PLC.
Last time I checked, Access didn't support hot links.
Guest
Aug 13 2005, 05:05 AM
Thanks for all the replies and this is the same Bob O. from at PLCs.net
Being the bad poster I didn’t mention all the software that is or could be in the mix if needed.
I do have the following if needed:
RSView32, RSLinx Gateway, RSLogix500 (assumed) and what ever else may be needed.
I have never done Active X [That I know of] so I will have to look into that and any pointers or an example would be appreciated.
Using VBA within RSView32, I have snooped around VBA but again, any examples that would get me started reading from MS Access and writing to the ML1500 through our Ethernet would also be appreciated.
Here is what I’m trying to do on this project.
Our scheduling software [custom written by another company] will send me an integer and a string for the job that I need to inspect for. I would then like this integer and string to get sent automatically to the ML1500 and then change jobs in my camera. I have the ML1500 changing jobs in the camera right now on the test bench when I enter a new value but would now like to take in to the next level and try doing it automatically.
I’m trying to eliminate the human involvement as much as possible.
I do have a back up set up for when my network cable is unplugged/goes down or is taken out by the fork truck with a HMI that the operator will have to select the job.
Thanks,
Bob O.
Bob O
Aug 13 2005, 12:29 PM
Update
I have set up a cold link to my ML1500 and I’m able to write a valve to the controller using a macro in Excel and pushing the command button.
Now to make this automatic without the command button would be a plus and then next to figure out how to do this in Access [since it was requested using SQL].
Thanks,
Bob O.
TechJunki
Aug 13 2005, 12:52 PM
You can update automatically using the OnTime Event
In the VBA tree you will see "This WorkBook" under Microsoft Excel objects. If you add the line Application.OnTime TimeValue("05:00:00"), "MySub" this will execute the Subroutine MYSub at 5:00. Simply create a subroutine and add you code to it from your command button and it will automatically run the code at the specified time.
As far as Access is concerned I would interface Excel or VB to talk with Access and use Excel or a Visual Basic program to Interface to your PLC, as I am not sure of Access's ability to do DDE or OPC comms with RsLinx. Retrieving information from a database using VB6 or Excel is relatively simple and may actually save some time.
Guest
Aug 13 2005, 01:00 PM
Thank you but I am looking to get it to run like every 5 sec. Sorry for not saying that.
Thanks,
Bob O.
Bob O
Aug 13 2005, 01:07 PM
I got it to run using the Sheet change in VBA. So when any of my cells change it will update the ML1500.
Now to still figure out Access or see if they can populate the Excel sheet.
Thanks again,
Bob O.
TechJunki
Aug 13 2005, 02:04 PM
This should help you get started, this is som basic code, it will take 4 fields in an access database and transfer them to an excel sheet from A1 to A4.
I have included the Access DataBase, And the Excel/Vba code.
The database must be in C:\Databases\ folder to work properly
Guest
Aug 13 2005, 03:35 PM
Tech,
Thank you. I am out doing some landscaping work taking a break you might say so I will play with this later today or in the morning and report back.
Thanks Again,
Bob O.
Guest
Aug 13 2005, 04:28 PM
Ok, I couldn't wait. I tried it but get a compile error: Can't find project or Library.
Any ideas or hints?
Thanks Again,
Bob O
TechJunki
Aug 14 2005, 07:07 AM
Under Tools --> References verify that Microsoft ActiveX Data Objects 2.8 Library is checked, and Microsoft Forms 2.0 object Library, if not scroll down and check it
Your References should look something like this........
Bob O
Aug 14 2005, 07:16 AM
Tech,
It was check.
The error highlights
Sub ADOImportFromAccessTable(DBFullName As String, TableName As String)
adOpenStatic in the ‘open the recordset and also
Any ideas and Thanks for your Help.
Bob O.
TechJunki
Aug 14 2005, 07:25 AM
Both References are checked??..
Can you do a PrintScreen and attach the error? Might be of some more help
Bob O
Aug 14 2005, 07:44 AM
Let see if this works.
TechJunki
Aug 14 2005, 08:07 AM
I see you are MISSING the Data Object Wizard, not sure if that is is but go back to references and click the browse button and Import this .dll file it is for the Data Object that you are missing.
Could you also send a print screen of the error you recieve, and show the line number.
Bob O
Aug 14 2005, 08:20 AM
Tech,
Here is three more print screens.
Thanks Again,
Bob O
TechJunki
Aug 14 2005, 08:50 AM
Did you remember to create the C:\Databases folder on your hard drive and copy the Access database file to it??
I think you maybe forgot the last "s" on Databases??
Bob O
Aug 14 2005, 09:15 AM
Tech,
It was that little "s".
Thanks Again,
Bob O.
Guest
Aug 14 2005, 10:13 AM
Tech,
If you don’t mind another question, Should I look into using something like Application.Ontime……. to get the macro to run on say 5 sec. intervals instead of using the Command button?
Thanks again for your help,
Bob O.
TechJunki
Aug 14 2005, 10:36 AM
You could use that to run the macro automatically although it will obviously take a lot of lines of code to fire the event every 5 sec
Personaly I would use an DDE Hotlink in Excel and have the PLC request an update from Excel by toggling the value of a cell from say 0 to 1 and then use the Worksheet_Calculate() function to fire the Macro.
Bob O
Aug 14 2005, 12:26 PM
Tech,
Got it. With your help, searching and hacking as I would call it since I don't know anything about VBA. I have it set up to update every 5 sec.
Here is the Excel file.
Thanks,
Bob O.
TechJunki
Aug 14 2005, 12:45 PM
Good luck with putting the entire project together, hope it all works out!! If you have any other questions you know where to look.
Guest
Aug 14 2005, 06:37 PM
Tech,
After taking another break from this I am back. Do you know of a way to use vba to simulate the enter button being pressed? I realized that I was still having to hit enter for the updates to work.
Thanks,
Bob O
Bob O
Aug 15 2005, 10:56 AM
Problem Solved. My code wasn't being called like I thought.
Bob O.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.