Solved

linking to rslinx and saving to an access database

Posted on 2002-07-15
7
733 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
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.

 

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

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 query that references subform 5 43
Access 2013 combo box not working 3 38
Add a task in Outlook from access 11 35
Problem to error 4 44
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 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

20 Experts available now in Live!

Get 1:1 Help Now