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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value for Parameter Query 1

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
Is it possibly to assign a default value for a perameter resulting from a query? For example, I would like user to use a pre filled in default vlaue (eg date) in the pop up parameter box which saves hin from having to enter one but he still has the ability to over write if necessary? I am using MS Access 97.
Cheers

AK
 
You can't set a default value with the regular parameter queries, so you are better off running the query from a form. This is an example of what I did. You can use this as a model. This is the query (qryParamQuery) I created.

SELECT *
FROM tblReview
WHERE AcctNum=[Forms]![frmParamQuery]![txtAcctNum];

Then I create an unbound form (frmParamQuery) with a text box (txtAcctNum). Set the default value in the text box. Then add a command button. Using the command button wizard, choose miscellaneous and then run query and pick the parameter query to run.


 
Thanks a lot. I was hoping to achieve this without using a form but apparently there is no such option. Thanks for your tip re form based criteria. Cheers

AK
 
Hi,

If you are using Access 200? you can create a parameter with a default value thus:

PARAMETERS prmRange long = 0, prmName Text(32);
SELECT fields FROM table WHERE ((Range = prmRange) AND (Name = prmText));

HTH

--
William
Software Engineer
ICQ No. 56047340
 
Thanks William. Unfortunately, I am not using Access 97 so I don't suppose I can use your tip?
Cheers

AK
 
Hi,

This isn't for Access 97 it's for 2000 and 2002. I don't know if it willl work in 97. I don't have it so I can't try.

Also, the above tip is for a stored query.

HTH

-- William
Software Engineer
ICQ No. 56047340
 
Sorry, I should say I am using MS Access 97 and not Access 2000. I tried, it does not work in Access 97.

Much appreciate your attention.
Cheers

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top