Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formulas in a sentence | Excel Discussion (Misc queries) | |||
Using a formula in a sentence | Excel Discussion (Misc queries) | |||
Need help triming a sentence | Excel Discussion (Misc queries) | |||
Sentence extraction | Excel Programming | |||
Finish this sentence | Excel Programming |