Professional OPC
Development Tools

logos

Reading and Writing from vba (Access 2016) to RSLinx Gateway

More
20 Jun 2020 11:51 #8609 by support
Hello,

is this the full and precise error text? (there certainly is a typo in it). I'd like to know the full thing - is there any error number also displayed, etc.? Ideally, provide a screenshot please.

Some other thoughts:

1. IIRC, several customer have had a licensing problem with RSLinx products, where remote usage is licensed differently, and they were not licensed. I do not think this is the case here, because a) the error message is different and b) if I understand correctly, the server is actually local (see further below), but wanted to mentioned it, just in cse.

2. The code looks like that is trying to address the OPC Server on the same machine where the client running, by obtaining and then using its computer name. This is not incorrect, but it makes the OPC client go through the "remote" code path, which is more complicated and may behave differently. For addressing OPC servers that are local, the recommended first argument to ReadItemValue is an empty string. Can you try it out?

Regards

Please Log in or Create an account to join the conversation.

More
20 Jun 2020 11:18 #8608 by jwomacks
I have decided that the best is to use vba code and read values directly into the tables.

I used this code and am getting and error that says "Failed eto find proxy registration ID" any thoughts

this is the method call that I am using


Dim computername As String

computername = VBA.Environ$("computername")

' Read item value and display it in a message box



testval = .ReadItemValue(computername, "RSLinx", "EMULATE.LocalTime[0]")


RSLinx is the OPC Server

EMULATE is the Opc Topic

LocalTime[0] is the tag

Please Log in or Create an account to join the conversation.

More
18 Jun 2020 06:26 #8598 by support
Hello, connecting to Access database is definitely supported in VS 2019, see e.g. docs.microsoft.com/en-us/visualstudio/data-tools/connect-to-...ase-windows-forms?view=vs-2019 . It would be easier to develop the program, let' say, in C#.

Some basic reading and writing examples:

- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...%20of%20a%20single%20node.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...rite%20a%20single%20value.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20nodes%20or%20attributes.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...Write%20multiple%20values.html

The alternative is to put the code into VBA in Access. QuickOPC can be used from VBA as well. Look under the "Visual Basic (VB 6) tab on the example pages.

Best regards

Please Log in or Create an account to join the conversation.

More
18 Jun 2020 05:34 #8597 by jwomacks
I was planning on just injecting the code into a module in access. I tried linking studio 2109 with access accdb file and found out that it is not supported.

Please Log in or Create an account to join the conversation.

More
17 Jun 2020 05:43 #8591 by support
Hello,

do you want to put the code into Access itself (VBA), or let's say into a separate program in another language (such as C#) that would connect to the OPC Server and to the Access database?

Best regards,
Z.
The following user(s) said Thank You: jwomacks

Please Log in or Create an account to join the conversation.

More
17 Jun 2020 04:11 #8589 by jwomacks
I have an Access 2016 project that I will be using to read and write data to a Rockwell PLC controller. I will be communicating to RSLinx Gateway via OPC UA and am looking for some example code to start the integration. Also please note that the server is not always in the local machine. Although due to the nature of any OPC client tool I have used , a remote connection is typical.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.196 seconds

      

 Recommend this on Google