Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Import Query from Access - Bug

I have this code:

Dim Data1 As ADODB.Recordset
Dim Connect As String

Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set Data1 = New ADODB.Recordset
Data1.Open "[Test Q]", Connect

Sheets(1).Range("A1").CopyFromRecordset Data1

The Query "Test Q" works in Access and I get an output there. But when I run
it in here, nothing is copied over. The script works if I put a table in
there. Why is this happening?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Import Query from Access - Bug

Try this instead "Test Q"

"J@Y" wrote:

I have this code:

Dim Data1 As ADODB.Recordset
Dim Connect As String

Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set Data1 = New ADODB.Recordset
Data1.Open "[Test Q]", Connect

Sheets(1).Range("A1").CopyFromRecordset Data1

The Query "Test Q" works in Access and I get an output there. But when I run
it in here, nothing is copied over. The script works if I put a table in
there. Why is this happening?

  #3   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Import Query from Access - Bug

My code for Test Q:

SELECT *
FROM VTABLE
WHERE VTABLE.ID between (Select VTABLE.ID
FROM VTABLE
Where VTABLE.Account = "2")
AND
(Select MIN( VTABLE.ID)
From VTABLE
WHERE VTABLE.Name like "*000000000*" AND VTABLE.ID ( Select VTABLE.ID
FROM VTABLE
Where VTABLE.Account = "2"));


I think something doesn't work for excel here, I tried breaking apart this
into parts and each part worked.....


"Mike" wrote:

Try this instead "Test Q"

"J@Y" wrote:

I have this code:

Dim Data1 As ADODB.Recordset
Dim Connect As String

Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set Data1 = New ADODB.Recordset
Data1.Open "[Test Q]", Connect

Sheets(1).Range("A1").CopyFromRecordset Data1

The Query "Test Q" works in Access and I get an output there. But when I run
it in here, nothing is copied over. The script works if I put a table in
there. Why is this happening?

  #4   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Import Query from Access - Bug

After alot of testing, the problem was Excel VB doesn't recognize Like
"*0000000*".
Instead of *, Excel uses %. This makes the Query not work in Access, but
works in Excel.

"J@Y" wrote:

My code for Test Q:

SELECT *
FROM VTABLE
WHERE VTABLE.ID between (Select VTABLE.ID
FROM VTABLE
Where VTABLE.Account = "2")
AND
(Select MIN( VTABLE.ID)
From VTABLE
WHERE VTABLE.Name like "*000000000*" AND VTABLE.ID ( Select VTABLE.ID
FROM VTABLE
Where VTABLE.Account = "2"));


I think something doesn't work for excel here, I tried breaking apart this
into parts and each part worked.....


"Mike" wrote:

Try this instead "Test Q"

"J@Y" wrote:

I have this code:

Dim Data1 As ADODB.Recordset
Dim Connect As String

Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set Data1 = New ADODB.Recordset
Data1.Open "[Test Q]", Connect

Sheets(1).Range("A1").CopyFromRecordset Data1

The Query "Test Q" works in Access and I get an output there. But when I run
it in here, nothing is copied over. The script works if I put a table in
there. Why is this happening?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Import Query from Access - Bug



"J@Y" wrote:

I have this code:

Dim Data1 As ADODB.Recordset
Dim Connect As String

Connect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set Data1 = New ADODB.Recordset
Data1.Open "[Test Q]", Connect

Sheets(1).Range("A1").CopyFromRecordset Data1

The Query "Test Q" works in Access and I get an output there. But when I run
it in here, nothing is copied over. The script works if I put a table in
there. Why is this happening?



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
Import Data from Access query Andy Excel Discussion (Misc queries) 8 April 23rd 09 09:15 AM
Database query to import from Access to Excel David T Excel Discussion (Misc queries) 0 August 31st 06 07:12 PM
access query to import to excel jazzydwit Excel Worksheet Functions 0 July 17th 06 02:03 AM
Import from Access query with prompts Michele Excel Discussion (Misc queries) 0 September 28th 05 04:41 PM
Import query from Access Kmarie Excel Discussion (Misc queries) 2 May 21st 05 04:00 AM


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

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

About Us

"It's about Microsoft Excel"