Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

parameter queries using VBA

Posted on 1997-09-19
3
Medium Priority
?
286 Views
Last Modified: 2006-11-17
I am trying to delete a set of records from a table using the following VBA, but it tells me to "specify the table containing the records I want to delete"...this also happens when I try to execute a normal query (without using VBA)

doCmd.RunSQL ("DELETE tblGrpDetails.dtlIDx, tblGrpDetails.dtlGroupLu, tblGrpDetails.dtlJobLu
FROM tblGrpDetails INNER JOIN TablesChosen ON tblGrpDetails.dtlJobLu = TablesChosen.TableName;
0
Comment
Question by:chapie
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
ozphil earned 200 total points
ID: 1956547
Try this
doCmd.RunSQL ("DELETE tblGrpDetails.*
FROM tblGrpDetails INNER JOIN TablesChosen ON tblGrpDetails.dtlJobLu = TablesChosen.TableName;

And in design view drag the asterisk from the field name list of the table whose records you wish to delete into the grid
0
 
LVL 3

Author Comment

by:chapie
ID: 1956548
don't know how that would work, I'll try at the office on Monday.

I don't know if you caught it but my topic/title had nothing to do with the question, that's because I was going to ask another question, but changed and forgot to change the topic.

Anyway, my point is that I fixed not only the origional problem, but because that problem was fixed I solved this problem but not needing to delete a join query, because I pass each record to the parameter query.  If you're interested I'll post the code how I did it, I don't know if you are familiar with using VBA w/ parameter queries, I had a tough couple of days trouble shooting this one.
0
 
LVL 4

Expert Comment

by:ozphil
ID: 1956549
I wondered about the question title, but concentrated on the actual question.

I have used VBA with parameter queries extensively.

Thanks Chapie
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question