Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Run Access query from Excel

Yeah, it is, here goes

enable your DAO and ADO references

dim dbs as database
dim wrkjet as workspace

fname = "filename of database plus full path"

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)

sql = "copy this from your query builder in Acces"
dbs.execute sql
dbs.close

Hope this helps

Nath
-----Original Message-----
Hi i want to run an acces append query from excel vba, i

can open the
database and run an autoexec macro but is not very

practical as you open the
database manualy and you have to cancel the the message

asking you to confirm
if you want to append the data.
i need that line to open the query from excel.

can any one help?

thanks.
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Run Access query from Excel

"nath" wrote ...

enable your DAO and ADO references

dim dbs as database
dim wrkjet as workspace

fname = "filename of database plus full path"

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)

sql = "copy this from your query builder in Acces"
dbs.execute sql
dbs.close


Why reference ADO if you are not using ADO?

Jamie.

--
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Run Access query from Excel

I'm trying to use this code and I keep getting Error 13 type missmatch on the
set dbs line - any ideas

Sub TestAccessRunQuery()
Dim dbs As Database
Dim wrkjet As workspace
fname = "\\Erbnfp4\Vol1\data\eps-s120\MANGMENT\HRO Team\HRO Team.mdb"
Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkjet.OpenDatabase(fname, True)
Sql = "SELECT 'Testdata' AS Testfield INTO Testtable;"
dbs.Execute Sql
dbs.Close
End Sub

Mark


"nath" wrote:

Yeah, it is, here goes

enable your DAO and ADO references

dim dbs as database
dim wrkjet as workspace

fname = "filename of database plus full path"

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)

sql = "copy this from your query builder in Acces"
dbs.execute sql
dbs.close

Hope this helps

Nath
-----Original Message-----
Hi i want to run an acces append query from excel vba, i

can open the
database and run an autoexec macro but is not very

practical as you open the
database manualy and you have to cancel the the message

asking you to confirm
if you want to append the data.
i need that line to open the query from excel.

can any one help?

thanks.
.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can I use MS Query in Excel like an Append Query in Access Sam Wardill Excel Discussion (Misc queries) 0 April 11th 06 02:41 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM
Access query vs. Excel query dutty Excel Programming 1 July 28th 04 07:19 PM
Excel Access Query Nigel[_8_] Excel Programming 5 February 13th 04 03:41 PM


All times are GMT +1. The time now is 05:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"