tags:

views:

42

answers:

3

Hi,

I have a query in MS ACCESS, I ran it in MS ACCESS:

SELECT * FROM table1 
INNER JOIN table2 ON table1.f1=table2.f1 WHERE table1.f2=table2.f2

It works fine. However, I need to save the results into another table. So, I changed it to:

SELECT * Into a1
FROM table1 INNER JOIN table2 ON table1.f1=table2.f1 WHERE table1.f2=table2.f2

It does not work. I receive this error: "Cannot Open database. It may not be a database that your application recognizes, or the file may be corrupt." Does anybody know how I can save the results in a database or txt file?

Thank you very much.

+1  A: 

Is the database read-only?

Some things to check:

Is the DB file's read-only attribute set?
Did you use "Open Read Only" to open the DB?
Are you out of disk space?
Is there enough disk space to create the new table?

Michael Goldshteyn
It might be the problem. Could you help me how to give it the write permission?
Shadi
No, I did not open it read-only
Shadi
I added some more possibilities to my answer..
Michael Goldshteyn
Thanks for your help. But mine does not seem to have these problems. Thanks anyways.
Shadi
+1  A: 

You can use the insert into command, see: http://msdn.microsoft.com/en-us/library/bb208861(office.12).aspx

Also appears that the database is in read only mode.

Shiraz Bhaiji
It does not work as well.
Shadi
Is the MS Access database on a CD?
Shiraz Bhaiji
No, It is on hard drive.
Shadi
Is this a local harddrive where you have read write permissions?
Shiraz Bhaiji
Yes it is local hard drive
Shadi
+1  A: 

You can easily output the results as a .txt file or a .csv file (that you can view in Excel). To export a .txt file:

DoCmd.TransferText acExportDelim, , "myQuery", "C:\myQuery.txt", True

You can research TransferText in help to see the options for a .csv file.

This should work easily.

awrigley