Solved

linking to rslinx and saving to an access database

Posted on 2002-07-15
7
725 Views
Last Modified: 2013-11-13
Through the properties on each field I am linking to a Programmable Logical Control using RSLinx and receiving data for display.  I want to also save this information to an access database.  What would be the best way to do this?
0
Comment
Question by:sjmmajor
  • 4
  • 3
7 Comments
 
LVL 3

Expert Comment

by:PNJ
ID: 7154500
Once the data is in the label (or whatever control you're using) then RXLinx has done its job and you just have to write the data that's in the control. I guess you'd have to know how the DDE link writes the data, if it's multiple values then RSLinx writes the values separated by CR/LF combinations. So you need a routine to split out the separate fields before you write them to a database.

Also, you have to know how the data is stored in the PLC memory because it's transferred "as is" into VB, and VB won't know this so it won't coerce the data to the correct data types.

Which bit are you having trouble with? Using Access or using RSLinx?
0
 

Author Comment

by:sjmmajor
ID: 7154678
Thanks for your quick response.  I am having trouble with the Access side.  The database is to reside on our NTserver in a shared folder.  When I connect a field to that database it gets hosed up and quits responding.  The computer isn't totally locked up just the VB application.  I tried keeping the database on the local computer and then linking the tables to the NTserver database.  I then have another VB application trying to grab that information from the server Access database.  The problem I ran into there is that when attaching the fields in the other VB application, it sees the table but not the field names.  Hope this is making sense.  Any help or ideas is greatly appreciated.

0
 
LVL 3

Expert Comment

by:PNJ
ID: 7154758
"connect a field to that database". Hmm. I wonder of RSLinx and Access are "fighting" for control of the VB control? In other words, are "DataField & DataSource" mutually incompatible with "LinkTopic & LinkMode"? I know that RSLinx seems to completly screw up when trying to use another program on the same PC with a Winsock control. When I did my RSLinx bits with VB5 I found that the LinkNotify event doesn't work either - I had to poll the value in the Label to determine whether data had arrived or not. So, may be you have to change tack somewhat and use native SQL to update the database? As in:

   If new data Then
      SQL = "UPDATE table SET column = " & Label1 & _
         "WHERE index = " & something
      Database.Execute SQL
   End If

Can you determine if RSLinx is the cause of the lock-up? Can you try changing the field value "by hand" with RSLinx turned off and seeing if the updates happen?
0
Highfive Gives IT Their Time Back

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!

 

Author Comment

by:sjmmajor
ID: 7157118
I was wondering myself if they were fighting each other.  I can get to the database without RSLinx.  I have put the RSLinx on Link_Request and then I am doing an update to the database by using the code:
Update.recordset.movelast
Update.recordset.Update

I want it to update over the only record in the database.  I do have a time field that I originally get from the system time of the computer.  I did notice that when it updates the time it looks like it is pulling from the database format and not the system clock.

Will the method you wrote above work for Access?

0
 
LVL 3

Accepted Solution

by:
PNJ earned 100 total points
ID: 7157154
The time will get displayed according to the format specified by the Access table - "time" isn't necessarily stored as text but as a number and Access displays it as "human-readable" time because thats how the field is defined.

I would "disconnect" the field from the database and update using the "UPDATE" SQL command or by updating a "SELECT"ed recordset - whichever you are more comfortable with.
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7157159
Sorry, yes, the method should work.
0
 

Author Comment

by:sjmmajor
ID: 7157209
Thanks for your help.  I will definitely try it.

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordmultiple challenge 12 89
MsgBox 2 37
vb6 connector to mongodb 2 26
Modifying Conditional Format from VBA code 3 29
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

707 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

16 Experts available now in Live!

Get 1:1 Help Now