Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know how to set a default on a parameter query 2

Status
Not open for further replies.

chubby

Programmer
Apr 28, 2001
278
US
I have a report that is due twice a week. The PAN (PAN: or Personnel Assignment Number) changes maybe every other month. Usually my end-users just type the [PAN] in, but lately the PAN has not changed. Is there anyway to set a default number on a parameter query.

Example:
Text box =sum ("[CWOB 32221]")/[PAN]
1. This give us the % of authorized workers
2. CWOB is Current Worker Onboard.

My end-users do this eight times because there are eight different departments that needs totaling.
It would be nice to have a default parameter query.

Thanks
 
Go into the query, delete the parameter and hard code your PAN that you need. If you need to keep the parameter query, a thing I've done in the past is have three versions of a query, one with the hard code, one with the parameter and a third (hash query?) that gets overwritten by one or the other depending on which I need. Then give the user a chance to select parameterized or hard coded and copy the appropriate query overtop of the hash query. Then the hash query is used for reports and such and allows for flexibility as you're talking about.

HTH Joe Miller
joe.miller@flotech.net
 
Joe, your the greatest, thanks for everthing!!! What is a hash query??? How do you set it up??? I looked in my Access 2000 Bible and Access 2000 Answers Books and I could not find it. Where is your source of information, beside what's in your head??? Are the two reference books I'm using okay or what???
Thanks again...
 
Hash query is not an actual term, just one I made up to try and get across what I was thinking. A Hash Table (this is a term) is a table that is temporary and used for a limited amount of time before being overwritten or repopulated with new data.

To accomplish what I was talking about take your existing query and Copy/Paste it two times. So now you have 3 queries which I'll call "qryHash" (your original that you copied), "qryParameter" (modify to be your parameter query), and "qryHardCode" (modify to be your hard coded PAN query). Now what is going to happen is when your user selects parameter query you will issue a command to (DoCmd.CopyObject is the command, look it up in help) you will copy qryParameter over top of qryHash. When they select Hard Code, copy qryHardCode over qryHash. Then just base all of your reports on qryHash which will be the correct type for your application. It's not unlike copying a file in DOS over another.

As for your books, I did not read those so I can't say whether they are good or not. I've read 4 different books on Access cover to cover:

Running Microsoft Access 97 (MS Books)
Mastering Access 97 Development (Alison Balter, SAMS Publishing)
Access 97 Programming (SAMS Publishing)
Access 97 Developer's Handbook (Sybex Publishing)

Most of my knowledge comes from applying the things I learned in the books on a day-by-day basis through my job, and through Tek-Tips of course! ;-) The built-in Access Help (press F1) is also very good as a reference, use it a lot.

HTH
Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top