Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

linking to rslinx and saving to an access database

Posted on 2002-07-15
7
Medium Priority
?
803 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 400 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
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.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

704 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