LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening an MS Access Form

Using the following VBScript I’ve exported from Access creates an error.

 

Attribute VB_Name = "Converted Macro- serial_port_configuration_2"

Option Compare Database

Option Explicit

Function serial_port_configuration_2()

On Error GoTo serial_port_configuration_2_Err

    DoCmd.OpenForm "setup_serial", acNormal, "", "", , acNormal

serial_port_configuration_2_Exit:

    Exit Function

serial_port_configuration_2_Err:

    MsgBox Error$

    Resume serial_port_configuration_2_Exit

End Function

 

Error Message

Script:    C:\My Code\Converted Macro-serial_port_configuration_2.vbs

Line:       2

Char:      1

Error:     Expected statement

Code:     800A0400

Source:  Microsoft VBScript compilation error

Steve Hall
stephen.hall@parker.com
0 Kudos
Message 1 of 6
(3,239 Views)
I'm not exactly sure what this has to do with LabVIEW. Are you using the Database Connectivity Toolkit? If so, are you getting any errors from a specific VI? Could you be more specific please?
Jarrod S.
National Instruments
0 Kudos
Message 2 of 6
(3,215 Views)

I am using the Database Connectivity Toolkit to preform operations on Access tables.  I have created forms that I'd like to open from LabVEIW.  My plan is to use the macro created by Access as I know of no way to open a form using the Database Connectivity Toolkit.  the toolkit seems to have the tools to create, write and querry tables but no way to open forms or reports created in Access.  I would like to use the Access forms and reports as it is much easier to create the forms and reports in Access than it is in LabVIEW. 

I’ve also tried to use ActiveX to open the form with no success.   I am using the methods DDEInitiate, DDEExecute , and the command DoCmd.OpenForm “Setup_serial”.

 

The ActiveX attempt resulted in the following error:

 

Error Code:  -2146828003

Exception occured in MSAccess: The other application can't perform the DDE function or retrieval you attempted.@The other application doesn't recognize the data or commands you supplied, or it doesn't recognize the item argument, based on the defined topic of the conversation.@Check the application's documentation to see what data or commands it recognizes.@1@@1Help Path is  and context -1 in set up interface 2.vi

 

Steve Hall
stephen.hall@parker.com
0 Kudos
Message 3 of 6
(3,207 Views)
Are you trying to execute the VBScript macro you created in Access from LabVIEW to access your form? Which function were you using when you got the original error?
Jarrod S.
National Instruments
0 Kudos
Message 4 of 6
(3,186 Views)

I was able to get LabVIEW to open the Access forms using scripts.  I used a product called Onscript to figure out how the scripts work.  Once I understoood the scripts I was able to open the forms in LabVIEW using an automation ref for Access and the same methods and properties used in the scripts.  Once I understood how things worked, the activeX controlls were easy to use and are a better solution than the scripts. 

Now I'm trying to figure out how to get the forms to open on the top level.  They open but the LabVIEW panel remains on top.  I've tried using activeX controls to minimize the LabVEIW panel but it only affects the panel at start up, not while the vi is running.

Steve Hall
stephen.hall@parker.com
0 Kudos
Message 5 of 6
(3,176 Views)
I found that the property FP.RunTransparantly worked for making the panel disappear.
Steve Hall
stephen.hall@parker.com
0 Kudos
Message 6 of 6
(3,171 Views)