Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Using ADO Recorsets in sql SELECT sentence

Hi,

I'm very new in SQL and VBa, so maybe it's very simple, but I'm not being
able to use one or more Recordsets in a SQL SELECT sentence.

Having 2 recordsets (opened) what I need is to relate them in a sql
populating a new recordset....
....
rsOne
rsTwo

ssql="SELECT rsOne!Field1,rsOne!Field2,rsTwo!Field1 FROM rsOne,rsTwo WHERE
rsOne!Field1=rsTwo!Field1"
rsThree.open cnn,,,adcmtext

But this gives me an error saying Microsoft Jet can't find rsOne object.

What I'm doing wrong?

Thanks for your help,




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Using ADO Recorsets in sql SELECT sentence

If you're using MS Access, or if you can use MS Access on your data just to
find the error, try using the graphical tools to do what you want to do and
then review the SQL that it creates. If you right-click the down arrow by
the View button in the upper right, one of the choices should be SQL View.

Sometimes it is not possible to use the graphical tools to create what you
want, and in that case my suggestion won't help you, but what you're
describing looks like a Select query relating two tables, and that can be
done using the graphical tools.

Hope this helps.

Keith

"sharon" wrote:

Hi,

I'm very new in SQL and VBa, so maybe it's very simple, but I'm not being
able to use one or more Recordsets in a SQL SELECT sentence.

Having 2 recordsets (opened) what I need is to relate them in a sql
populating a new recordset....
...
rsOne
rsTwo

ssql="SELECT rsOne!Field1,rsOne!Field2,rsTwo!Field1 FROM rsOne,rsTwo WHERE
rsOne!Field1=rsTwo!Field1"
rsThree.open cnn,,,adcmtext

But this gives me an error saying Microsoft Jet can't find rsOne object.

What I'm doing wrong?

Thanks for your help,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Using ADO Recorsets in sql SELECT sentence

Keithlo ,

Thanks for your answer. In fact, I'm working over FoxPro data tables, in
different folders, and this (AFAIK) makes unfeasible your point.

So far, I decided to create new recordsets hopping I could be able to relate
them in a single new sql sentence. But I can't find out how to referenciate
these recordsets in the sql string sentence. If possible...(I guess it is..)

Regards,



"Keithlo" wrote:

If you're using MS Access, or if you can use MS Access on your data just to
find the error, try using the graphical tools to do what you want to do and
then review the SQL that it creates. If you right-click the down arrow by
the View button in the upper right, one of the choices should be SQL View.

Sometimes it is not possible to use the graphical tools to create what you
want, and in that case my suggestion won't help you, but what you're
describing looks like a Select query relating two tables, and that can be
done using the graphical tools.

Hope this helps.

Keith

"sharon" wrote:

Hi,

I'm very new in SQL and VBa, so maybe it's very simple, but I'm not being
able to use one or more Recordsets in a SQL SELECT sentence.

Having 2 recordsets (opened) what I need is to relate them in a sql
populating a new recordset....
...
rsOne
rsTwo

ssql="SELECT rsOne!Field1,rsOne!Field2,rsTwo!Field1 FROM rsOne,rsTwo WHERE
rsOne!Field1=rsTwo!Field1"
rsThree.open cnn,,,adcmtext

But this gives me an error saying Microsoft Jet can't find rsOne object.

What I'm doing wrong?

Thanks for your help,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Using ADO Recorsets in sql SELECT sentence

ADO doesn't work like that: recordsets can't be queried using SQL as though
they were tables.
You need to get your records into tables in the same database (or you could
dump them into named ranges in a worksheet...)

Tim


"sharon" wrote in message
...
Hi,

I'm very new in SQL and VBa, so maybe it's very simple, but I'm not being
able to use one or more Recordsets in a SQL SELECT sentence.

Having 2 recordsets (opened) what I need is to relate them in a sql
populating a new recordset....
...
rsOne
rsTwo

ssql="SELECT rsOne!Field1,rsOne!Field2,rsTwo!Field1 FROM rsOne,rsTwo WHERE
rsOne!Field1=rsTwo!Field1"
rsThree.open cnn,,,adcmtext

But this gives me an error saying Microsoft Jet can't find rsOne object.

What I'm doing wrong?

Thanks for your help,






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
Formulas in a sentence krissy Excel Discussion (Misc queries) 5 February 26th 10 03:25 AM
Using a formula in a sentence krissy Excel Discussion (Misc queries) 5 February 25th 10 04:55 AM
Need help triming a sentence Jim Excel Discussion (Misc queries) 8 November 25th 09 10:48 PM
Sentence extraction Viking Excel Programming 2 July 24th 06 05:30 PM
Finish this sentence scottnshelly[_28_] Excel Programming 3 April 30th 04 10:20 AM


All times are GMT +1. The time now is 02:06 PM.

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"