Using into Table And drop Table In Vb
Need your help badly . I have two tables in
MS.Access DATABASE and I'm required to keep pulling
out records out of them based on some criteria and
then work on the queried results ,so I land up with
SQL queries like this where I used a lot of INTO
table statements .
SELECT [MAIN_ID], [TIME], [DIRECTION], [LICENSE_TAG],
[DESCRIPTION_ID] INTO MAIN_TABLE2
FROM MAIN_TABLE
WHERE LICENSE_TAG<>'1' And LICENSE_TAG<>'2' And
LICENSE_TAG<>'3' And LICENSE_TAG<>'4' And
LICENSE_TAG<>'@1' And LICENSE_TAG<>'@2' And
LICENSE_TAG<>'@3' And LICENSE_TAG<>'@4' And
LICENSE_TAG<>'@5' And LICENSE_TAG<>'5' And
LICENSE_TAG<>'@2?' And LICENSE_TAG<>'@2??';
SELECT MAIN_TABLE2.TIME, MAIN_TABLE2.LICENSE_TAG,
MAIN_TABLE2.DIRECTION, [DESCRIPTION].[GATEWAY],
[DESCRIPTION].[LOCATION_DESCRIPTION] INTO ALLTABLE
FROM MAIN_TABLE2, DESCRIPTION
WHERE MAIN_TABLE2.DIRECTION=0 And
[DESCRIPTION].[CITY_ID = 2 And
[DESCRIPTION].DESCRIPTION_ID=MAIN_TABLE2.DESCRIPTION_ID;
Etc.Now when I use this in VB ,it work fine as long as
I use DROP the table after the operation is done .I
use the Rs.Open TO OPEN RECORDSET
Rs.Open "SELECT MAIN_TABLE2.TIME,
MAIN_TABLE2.LICENSE_TAG, MAIN_TABLE2.DIRECTION,
[DESCRIPTION].[GATEWAY],
[DESCRIPTION].[LOCATION_DESCRIPTION] INTO ALLTABLE
FROM MAIN_TABLE2, DESCRIPTION
WHERE MAIN_TABLE2.DIRECTION=0 And
[DESCRIPTION].[CITY_ID = 2 And
[DESCRIPTION].DESCRIPTION_ID=MAIN_TABLE2.DESCRIPTION_ID",Conn,
,
Now I want result of this query in a EXCEL spreadsheet
whose code should come between the Rs.Open Statement
and drop .Like it should accomplish the following
1)Open Recordset
2)Print on to a EXCEL SHEET
3)Drop the TABLE
4)Close the Recordset
Anybody has idea how to do it or if you have a better
suggestion then mail immediately .
Thanks in advance for your help and awaiting response
.
Please ...
Anitha .

