473,467 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Run an Acess.saved query from Excel

2 New Member
In my Workbook Open event, I'm trying to run a saved Access query and put the results in my worksheet named "Names":

Private Sub Workbook_Open()
Dim oSheet As Object
'Create the QueryTable
Dim aSMMdb As String
aSMMdb = "ASMMV4AVa.mdb"
Dim oQryTable As Object
Set oQryTable = Sheets("Name").QueryTables.Add( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
aSMMdb & ";", Sheets("Name").Range("A1"), "Select * from Excel")
oQryTable.RefreshStyle = xlInsertEntireRows

End Sub

Wnhen it runs, I get a subscript out of range message. Can someone help me?
Nov 14 '07 #1
0 770

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben | last post by:
I am able to sucessfully open/save an asp page that contains table data in an Excel format using: Response.ContentType = "application/vnd.ms-excel" The purpose of this functionality is to...
0
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I...
0
by: John Wilhelm | last post by:
I'm using VB.net writing out to an Excel file. every thing works fine BUT the following code does not saved the "PrintTitleRows " or "PrintTitleColumns " information to the file when the worksheet...
0
by: Pk | last post by:
Hi, I want to download and upload the data from acess database into excel file or from excel to database. So how can i use "Excel.Application" to do this type of job. So please help me soon. ...
2
by: sonasiva | last post by:
hai Iam creating my own website using ASP and MS ACESS ,iam new to ASP and SQL Please help me to write a query to finish my project. i have datas as follows in my database sno name ...
0
by: mykhan | last post by:
I have been using access database with asp.net pages. I just realized a problem with date saving in access table. I didnt give any specific format for the date when saved in tables, because I wanted...
3
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few...
1
by: lokeshreddy16 | last post by:
'this is my code plz guys help how to save data from vb 2005 and other this that i am able to view the data from acess but i am not able save to acess i dont whether my code for save is correct of...
3
by: geotecman | last post by:
Hello, I use the below code I got from the internet to update my access from excel. Is there a way for the program to check and see if my project number which is in range("B2:B5600") exists in the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.