Required Field based on date

GeminiG

New Member
Joined
Feb 22, 2016
Messages
13
Hi All,
I'm trying to make a field required based on another date field on a new order form. I just had to add a new field to my database but I can't make it required for dates before 1/1/16 otherwise my forms will throw a bunch of errors when a user goes back to older records. In the VBA or expression builder I'd want something like :

tblOrders.Justified (If tblOrders.OrderDate >= 1/1/2016 then field required else not required
Is that possible? Is there an other/easier way?

Many thanks for any help you can provide.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the Board!

Why not just add the field, use an Update Query to populate all the old/current records with some value, then make it required?
Then all old records will have a value and all future records will require a value.
 
Upvote 0
After the backfill instead of "required" you can use validation instead, such as greater than Jan 1, 2016. That will prevent your users from entering a "dummy" date if they figure out that the required field will still allow dates like Jan 1, 1970 (which would probably defeat the purpose of the field being required).

For the most fluid user experience, you can put validation in the form and not just at the database level, which allows you to have better validation messaging at the time of data entry.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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