How to make Date criteria dynamic

BizBoy

Board Regular
Joined
Jul 26, 2012
Messages
118
Hi,

I am using below query to get data for 10-Apr-2018.
How do I make 'date' part dynamic or user friendly.

For example, if user wants to select data for 4-Apr-2018.
How to provide him option to select data for 4-Apr-2018 without forcing him to manually editing query.

Can anyone please help me in this.

SELECT [Combine].Date,[Combine].[Employee Code] AS Code, [Combine].[Full Name] AS Name, [Combine].Process, [Combine].Designation, [Combine].DOJ
FROM Combine
WHERE Program = 'Services' and Date = #4/10/2018#;
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
on your form is an unbound textbox, Format set to one of the date choices - likely short date. The calendar date picker will appear if a date format is chosen. User clicks on control and picks a date, and the query references that textbox to get the date. How you get the query to run is up to you, but the 'safest' is usually to require that they click a button. That way, you don't automatically run things if the wrong date was chosen and user wishes to correct before running. Not enough information to elaborate much beyond that, as factors such as nav forms, subforms and other things such as the desire to ensure a date is entered into the field, are unknown.
BTW, Date and Name are reserved words and shouldn't be used for object names or aliases.
 
Last edited:
Upvote 0
Hi Micron,

Thanks for the help. I will change words right now. I had forgotten about this rule.
Thanks for helping me on this.

I will try do it with forms. Will post my doubts while creating the same.
Have a nice day ahead. :)
 
Upvote 0

Forum statistics

Threads
1,221,621
Messages
6,160,879
Members
451,675
Latest member
Parlapalli

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