Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

INTERFACING WITH MSACCESS VBA

More
03 Jul 2021 06:19 #9882 by support
I also want to add that while there aren't OPC examples directly for "VBA in Microsoft Access", we have many examples in VB 6.0, and VB6 as a language is almost identical to VBA.

As such, whenever there is an example in the documentation (User's Guide, opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...l#QuickOPC%20Cover%20Page.html ) that has a "VB6" tab on the language bar, you can use it.
All examples that are scattered through the documentation are then collected under Examples -> Examples in the documentation (List).

There is also a VB6 project with these examples, installed with the product (the .FRM files from the project are textual files that contain the code that you can use, even if you do not have the actual VB6 program).

Best regards

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

More
02 Jul 2021 17:33 #9881 by support
Yes, with QuickOPC, you can use VBA inside Microsoft Access to access OPC Classic, OPC XML-DA and OPC UA (Unified Architecture) data.

(It should be said that what you have described can also be done in different ways. In principle there is no need for the code to reside inside the Access database - both the OPC access and the database access can be arranged from some "outside" program written in any suitable tools, such as in .NET. But you may have your own good reasons for doing it the way you suggested, such as if you already have an existing application code using this VBA approach).

In a nutshell, here is what you need to do for getting the first data through:
  1. In your VBA, reference the necessary QuickOPC type library/libraries: See opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...0the%20Components%20(COM).html .
  2. On the appropriate place in your code, add statements to create our EasyDAClient or EasyUAClient object, and call its method such as ReadItemValue or ReadValue (see further below).
  3. Use the obtained value and process it as you need - e.g. insert it into some table.

Attached is a database (zipped) that I have made from a blank project. I added a form and set it as startup form, and then I have added code to the Load event of the form to read OPC data and display them in a text box.

File Attachment:

File Name: UAReadAndD...alue.zip
File Size:29 KB

(QuickOPC 2021.2 needs to be installed, with "COM development" choice selected in the Setup wizard, for this to work).

The code in the form is as follows:
Private Sub Form_Load()
    ' Create EasyOPC-UA component
    Dim Client As New EasyUAClient
 
    ' Read node value and display it
    Text0 = Client.ReadValue("http://opcua.demo-this.com:51211/UA/SampleServer", "nsu=http://test.org/UA/Data/;i=10853")
End Sub
I hope this helps. Feel free to ask additional questions - but I suggest you look around the documentation (www.opclabs.com/documentation ) and the examples available too.

Best regards
Attachments:

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

More
02 Jul 2021 11:16 #9879 by Rivadossi
Hello,
I'd like to know if I can interface to your software using vba built in MsAccess . If yes, how ?
I have an sql database on my server , I populate it with MSaccess , I need to collect informations from an S7 Siemens and store them in a table of my sql database
Thank you

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

Moderators: support
Time to create page: 0.048 seconds