end date

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
hi,

i am using MSAccess & in the query I use the following;-

Between [Enter Start Date] And [Enter Finish Date] Or Like [Enter Start Date] & "*"

The above runs via a macro & asks for a start date, then end date. The end date will always be whatever 'todays date' is at the time of running the macro'

it wokks ok . but is it possible to change the query so that the end date will always be the relevant 'to days date'? So the user only has to input the desired 'start date'?

many thanks in advance and for your help.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I don't quite understand what this is doing in your expression,

SQL:
Or Like [Enter Start Date] & "*"

... but if you want to reference the current date, you can do so with Date():

SQL:
Between [Enter Start Date] And Date() Or Like [Enter Start Date] & "*"
 
Upvote 0
Hi JonXL,

thanks for your reply & aplogees if I have not given you the 'whole nine yards'

Below are the sequience of screen shots , which i hope will make a tad more sense. Thiey are taken from the applicable 'query screen' which i then envoked 'run' to demostrate.


1635767913635.png



1635767970635.png




1635768012324.png

the above (last screen) I would like it to mashow the current date, but allow for another date to be entered.

many thanks again.
 

Attachments

  • 1635767869456.png
    1635767869456.png
    98 KB · Views: 20
Upvote 0
I would like it to mashow the current date,
What's "mashow"?
Still don't understand what you want. You're getting prompted to enter the 2nd (finish) date, which is what you've asked for.
If you're asking how to automatically pick a 2nd date that is x number of days after the start date, use the DateAdd function as your query criteria expression.
 
Upvote 0
Hi.

Your original ask was to use the current date in place of a user-supplied end date. My solution will get you that.

If you now have another or different requirement, that is fine. We can try to resolve it. However, I am with the others who have commented in that I don't quite understand what this new requirement is asking. Could you try to reword it a little? Or do you mean you want the prompt to still show but to default the value to today's date (so users wanting to go that route just click OK while others can enter another value if they want)?
 
Upvote 0
Or do you mean you want the prompt to still show but to default the value to today's date (so users wanting to go that route just click OK while others can enter another value if they want
I think you are right, @JonXL.

However, I don't know if it is possible to assign a default value in the internal input box of the query parameter. (I'd love to learn if it is).

Not the best way but maybe the following could be used as the finish date parameter in the query, and instruct users that they can leave it blank to enter today's date.

SQL:
Nz([Enter Finish Date (press Enter key for today)], Date())

1635861705541.png
 
Upvote 0
AFAIC to provide a visible default date you'd have to use a form that looks like a parameter prompt. The IIF function would also work but to me, a form would look better than having to place instructions in the prompt code. It would also allow you to display the built in calendar control by clicking on the date textbox.
 
Upvote 0
What's "mashow"?
Still don't understand what you want. You're getting prompted to enter the 2nd (finish) date, which is what you've asked for.
If you're asking how to automatically pick a 2nd date that is x number of days after the start date, use the DateAdd function as your query criteria expression.
Hi,
thanks for your reply. 'mashow' is a typo and should of read 'I would like it to show the current date, but allow for another date to be entered'. My apologees for this .
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top