simple SELECT question

  • Thread starter Thread starter robertfuschetto via AccessMonster.com
  • Start date Start date
R

robertfuschetto via AccessMonster.com

I have code to delete the contents of a table. I have code to repopulate it.
This works fine.

I tried adding code to group the table contents and open it and the code
fails with an error.

Dim db As Database
Set db = CurrentDb()
sqlstr = "SELECT tbl_TempList.Name1, tbl_TempList.Table1FROM tbl_TempList
GROUP BY tbl_TempList.Name1, tbl_TempList.Table1;"

DoCmd.RunSQL sqlstr

Error results:
A runSQL action requires an argument consisting of an SQL statement.

Ideas?????
 
Try OpenQuery if you want to see the results, or OpenRecordset if you want
to operate on it programmatically without viewing the query output.
 
I have code to delete the contents of a table. I have code to repopulate it.
This works fine.

I tried adding code to group the table contents and open it and the code
fails with an error.

Dim db As Database
Set db = CurrentDb()
sqlstr = "SELECT tbl_TempList.Name1, tbl_TempList.Table1FROM tbl_TempList
GROUP BY tbl_TempList.Name1, tbl_TempList.Table1;"

DoCmd.RunSQL sqlstr

Error results:
A runSQL action requires an argument consisting of an SQL statement.

Ideas?????


You're attempting to run a Select query using RunSQL. You cannot run a
Select query using RunSQL, only action queries, i.e. Delete, Update,
etc. Read VBA help files.
 
....been trying to get them to install the help files so I can...for now I
must look for a book...do you reccomend one?
I have code to delete the contents of a table. I have code to repopulate it.
This works fine.
[quoted text clipped - 13 lines]
Ideas?????

You're attempting to run a Select query using RunSQL. You cannot run a
Select query using RunSQL, only action queries, i.e. Delete, Update,
etc. Read VBA help files.
 
Back
Top