Solved

linking to rslinx and saving to an access database

Posted on 2002-07-15
7
776 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
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.
This video teaches viewers about errors in exception handling.
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…

632 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