Execute SQL Server Pass-Through Query From Access VBA

mntyguy

I have an UPDATE pass through query saved in Access 2007. When I double-click on the pass through query it runs successfully. How can I get this query to run from VBA? I'd like it to run when my "splash screen" loads.

I'm currently using the following code:

CurrentDb.Execute "Q_UPDATE_PASSTHROUGH", dbSQLPassThrough

But I get the following message:

enter image description here

The pass-through query contains all the connection information and I've confirmed the SQL syntax is correct by running it multiple times, so not sure what I'm missing in my VBA call.

HansUp

Use the QueryDef's Execute method:

CurrentDb.QueryDefs("Q_UPDATE_PASSTHROUGH").Execute

I don't think you should need to explicitly include the dbSQLPassThrough option here, but you can try like this if you want it:

CurrentDb.QueryDefs("Q_UPDATE_PASSTHROUGH").Execute dbSQLPassThrough

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to execute SET IDENTITY_INSERT ON/OFF with a pass-through query from Access VBA?

From Dev

In MS Access SQL Server Linked Table pass through query

From Dev

MS-access Pass-Through Query to SQL Server 2008 Adding Prefix

From Dev

SQL Server cursor - loop through multiple servers and execute query

From Dev

Changing query from access SQL to SQL server

From Dev

How to pass a SQL query result to variable with VBA Access

From Dev

SQL query in access vba

From Dev

Execute a SQL Server stored procedure from MS Access

From Dev

How to pass comma separated string in Oracle PL/SQL and iterate through it to execute a query?

From Dev

Can't execute query to an Azure SQL Server from PowerShell

From Dev

Possible for T-SQL pass-through query in Access to include a local Access table?

From Dev

Possible for T-SQL pass-through query in Access to include a local Access table?

From Dev

SQL Server Query in Access

From Dev

Execute SQL Server stored procedure through VBA which does not return rows

From Dev

Setting RowSource in Access with Pass through query

From Dev

Setting RowSource in Access with Pass through query

From Dev

Dynamically create Datasheet from SQL query with VBA in Ms Office Access

From Dev

SQL Query from Excel via VBA to Access (date specific)

From Dev

SQL Server : query to loop through

From Dev

Running SQL Query In Access VBA

From Dev

Access VBA DlookUp Query SQL

From Dev

Execute SQL Server stored procedure through SSIS

From Dev

Execute SQL Query from excel

From Dev

Execute SQL Query with VBA and fill sheet with data

From Dev

Can Access pass-through queries see global temp tables on SQL Server created using ADO and/or SSMS?

From Dev

Can Access pass-through queries see global temp tables on SQL Server created using ADO and/or SSMS?

From Dev

Issues formatting numbers in Access from SQL Server query

From Dev

Insert Bool from Access Query into SQL Server database

From Dev

Create stored procedure in SQL Server from a MS Access update query

Related Related

  1. 1

    How to execute SET IDENTITY_INSERT ON/OFF with a pass-through query from Access VBA?

  2. 2

    In MS Access SQL Server Linked Table pass through query

  3. 3

    MS-access Pass-Through Query to SQL Server 2008 Adding Prefix

  4. 4

    SQL Server cursor - loop through multiple servers and execute query

  5. 5

    Changing query from access SQL to SQL server

  6. 6

    How to pass a SQL query result to variable with VBA Access

  7. 7

    SQL query in access vba

  8. 8

    Execute a SQL Server stored procedure from MS Access

  9. 9

    How to pass comma separated string in Oracle PL/SQL and iterate through it to execute a query?

  10. 10

    Can't execute query to an Azure SQL Server from PowerShell

  11. 11

    Possible for T-SQL pass-through query in Access to include a local Access table?

  12. 12

    Possible for T-SQL pass-through query in Access to include a local Access table?

  13. 13

    SQL Server Query in Access

  14. 14

    Execute SQL Server stored procedure through VBA which does not return rows

  15. 15

    Setting RowSource in Access with Pass through query

  16. 16

    Setting RowSource in Access with Pass through query

  17. 17

    Dynamically create Datasheet from SQL query with VBA in Ms Office Access

  18. 18

    SQL Query from Excel via VBA to Access (date specific)

  19. 19

    SQL Server : query to loop through

  20. 20

    Running SQL Query In Access VBA

  21. 21

    Access VBA DlookUp Query SQL

  22. 22

    Execute SQL Server stored procedure through SSIS

  23. 23

    Execute SQL Query from excel

  24. 24

    Execute SQL Query with VBA and fill sheet with data

  25. 25

    Can Access pass-through queries see global temp tables on SQL Server created using ADO and/or SSMS?

  26. 26

    Can Access pass-through queries see global temp tables on SQL Server created using ADO and/or SSMS?

  27. 27

    Issues formatting numbers in Access from SQL Server query

  28. 28

    Insert Bool from Access Query into SQL Server database

  29. 29

    Create stored procedure in SQL Server from a MS Access update query

HotTag

Archive