How to put a default value into a parameter query?

  • Thread starter Thread starter Bucky
  • Start date Start date
B

Bucky

I have a make table query that I want to have the user enter a date to
mark the records with. I have a field in the query that is basically
there to enter the date... looks like as follows:


ImportDate2: Format([Enter date you want assigned to these
records:],'mm/dd/yyyy')


It all works just fine, but when the dialog box comes up requesting the
user to enter a date, I want to have a default value of today's date in
the dialog box. Is there any way to do it?

Thanks all!
 
Bucky said:
I have a make table query that I want to have the user enter a date to
mark the records with. I have a field in the query that is basically
there to enter the date... looks like as follows:


ImportDate2: Format([Enter date you want assigned to these
records:],'mm/dd/yyyy')


It all works just fine, but when the dialog box comes up requesting
the user to enter a date, I want to have a default value of today's
date in the dialog box. Is there any way to do it?

Make a function (fGetParamDate()) that uses a Inputbox(...)
to ask the value and retrieves it to the query.
You can put a default to Inputbox-function.

then use in query:
ImportDate2: fGetParamDate()
 
Bucky,

I assume the MakeTable Query is triggered by an event on a form, for
example click a command button, or when some data is entered, or some
such? I would do it like this... Put an unbound textbox on the form
where the user can enter the date for the query. You can set the
Default Value property of the textbox to Date() and the user can
overwrite this if necessary. Then, in your query, instead of the
parameter prompt, do it like this...
ImportDate2: [Forms]![NameOfForm]![NameOfTextbox]
 
Back
Top