ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel running Access query (https://www.excelbanter.com/excel-programming/395373-excel-running-access-query.html)

Nigel RS[_2_]

Excel running Access query
 
I have an Excel application that gets data from an Access database.

What I wish to do is run some code from Excel to automate the updating of
the Access database. Within thew Access database I have an append query set
up. How can I run this query from Excel?

Many thanks in advance.

Trevor via OfficeKB.com

Excel running Access query
 
Using ADO:

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection

With cn
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.ConnectionString = "Data Source=DBFileName"
.Open
With .Command
.CommandText = "qryName"
.CommandType = adCmdUnknown
.Execute
End With
.Close
End With


Nigel RS wrote:
I have an Excel application that gets data from an Access database.

What I wish to do is run some code from Excel to automate the updating of
the Access database. Within thew Access database I have an append query set
up. How can I run this query from Excel?

Many thanks in advance.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1


Nigel RS[_2_]

Excel running Access query
 
Many thanks

"Trevor via OfficeKB.com" wrote:

Using ADO:

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection

With cn
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.ConnectionString = "Data Source=DBFileName"
.Open
With .Command
.CommandText = "qryName"
.CommandType = adCmdUnknown
.Execute
End With
.Close
End With


Nigel RS wrote:
I have an Excel application that gets data from an Access database.

What I wish to do is run some code from Excel to automate the updating of
the Access database. Within thew Access database I have an append query set
up. How can I run this query from Excel?

Many thanks in advance.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1




All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com