Solved

linking to rslinx and saving to an access database

Posted on 2002-07-15
7
759 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum5 challenge 5 114
Export Data to Different .csv Files 27 133
adding "ungroup sheets" to existing vbs code 5 75
Modify Text File with Excel Macro 13 51
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…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

751 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