Read PLC Data to Access 2000

garryt1

Member
Join Date
Jun 2002
Location
n.ireland
Posts
128
Hi there,

I was wondering if anybody could tell me the format for a sub read() for access 2000 to read data form an AB plc5/40.I have checked out the ab website and dowmloaded a helpfile which will not work due to it being for access 97.I would be grateful if someone could point me on this one as i have tried several different aspects which have all failed.I think my main problem is defining the workspace and database aspect of access 2000.

cheers! banghead
 
I'd guess you have to start with buying a DDE/OPC communications server (RSLinx for one) to start with to get the comms going from the PLC to the PC.

Other option is to modify the PLC program to start spitting out some kind of ASCII message over the serial port, and then dealing with that in Access.
 
Hi there,

I think you misunderstood me when i was looking for help,i already have rslinx 2.30 prof edition and am trying to get it to read the data from the plc into access2000. However,with the help file that AB have on their website it has failed as it was originally set up for access97.The objects within access seem to have changed form 97 version.where a database was defined before as a string i cannot get this to work.
 
Are you saying that you had this working in ACC97 but now you can't get it to work in ACC00? Or, is this a first attempt? Have you set up the clients in LINX?
 
Hi ed,

Yes the clients are set up already in linx,i have been using the clients before for vb and excel spreadsheets and they are not the problem.

and no i did not have this working on access 97,the AB website example is for access97.

This will be a whole new area for me,i want to get AB to write data to an access database but i thought it might just be as simple as excel or vb,problem is the call to the plc in access2000 will not work .
 
Hi,

I've recently been developing some MSAccess VBA to read data into a table from a ControlLogix using OPC. From what I've seen on the OPC side of things, the only difference with the other processors is that you use addresses rather than tagnames.

It's not as striaght forward as getting DDE info, but seems to be a lot more robust. I've just taken code straight from the OPC DA spec v.20 and it works fine.

Is this the kind of thing you're after? Or is it the actual Access VBA code for writing data into tables? I know in Excel you can just use DDE topics directly in the cell formula to get the data, but there's no equivalent in Access that I know of.

Steve
 
Hi Steve,

What i am trying to do is read data from plc5 integer tables via DDE into an access table.I have used vb to call/read this data before in a sub(),then i can interragate the data whatever way i want in vb whether it be into a textbox or something similar.
It i imagine would be along the lines:

Sub Read Word()
define db
define recordset
rsichan ("rslinx|topic")
if int change then read N?:0
Write N?:0 into table1.column/row
else
do nothing

end sub

the problem i am having is the sub in access reading,where when i define objects i get a vba runtime fault .If you know this procedure for access2000 i would be grateful.

cheers. beerchug
 
The code you use to write to the access table depends on whether you're using DAO or ADO.

For DAO (the default) it would be along the lines of :
Dim TagChanged As Recordset
Set TagChanged = CurrentDb.OpenRecordset("TagData", dbOpenDynaset)
'Where TagData is the name of the table you want to write to
TagChanged.MoveFirst
'Some code here to go to the relevant record
TagChanged.Edit
TagChanged("TagValue") = Tag1Val
'TagValue is the name of the field in the recordset. Tag1Val is the value aquired from DDE
TagChanged.Update


If you're using ADO, just construct a SQL statement which updates that record.

Dim cmUpdate As New ADODB.Command 'New ADO command

Set cmReportDemand.ActiveConnection = cnDB
'Where cnDB is a previously defined connection to the database

SQL = "UPDATE TagData SET TagValue = " & Tag1Val & " where TagName = '" & TheTagName & "'"
With cmUpdate 'Execute the command
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With

I've used both of the above with an OPC DataChange event on an OPCServer object declared withevents.
Everything declared locally to the procedure, no run time errors. If you're still getting problems, probably best to approach an MSAccess forum with the question & your code.

Steve
 

Similar Topics

Hi Iam using monitouch hmi(V9 soft) with omron plc cj2m (CX programmer). In this I want to read a data from hmi to plc. The data was like...
Replies
0
Views
94
Dear Experts, Please, kindly guide me through how to read data from ABB PLC to S7-1200 Siemens PLC. I want to use Siemens S7-1200 PLC to read data...
Replies
1
Views
445
Hello everyone, I'm working with an old ACM3710 device and I'm encountering an issue with the data frames I'm sending over an RS232 connection...
Replies
5
Views
680
Hi All, I need to read some data from a Rockwell 5380 PLC to a schnieder m340 PLC. What hardware will i require for both systems? on the M340...
Replies
12
Views
5,281
Trying to set up a Logix 5000 L73 controller so the customer's Ovation DCS can read some analog and digital values at specific addresses. I think...
Replies
1
Views
1,165
Back
Top Bottom