Solved fixed date

rainbows

Registered User.
Local time
Today, 01:17
Joined
Apr 21, 2017
Messages
428
hi when i tick parts ordered box the date comes into the box . i thought that date would not change but have noticed it did . the control source mentions ,now() should it be date() for it not to change ?

thanks steve


1676312192233.png
 
It is going to change either way?
You would need to see if it is already populated before you decide to set it?
 
1. NEVER use Now() when you really want Date(). You are just making a future problem for yourself. Now() includes time of day. Date() is just plain date.
2. You really don't want to show a new date unless something changed. Your code always calculates a new date value and it should not. We need to know the business rule to help with this.
 
when the user ticks that box they cannot undo it it is password protected as this stops parts being re ordered this date tells me when parts where ordered




1676313451031.png
 
But you are setting it as the control source, so when you load that record, the control gets changed with the latest Date/Date&time (makes no difference, logic is completely wrong), if Parts_Ordered is true, which it is going to be after you initially set it and lock it? :(
 
You need to add a field in your table called PartOrderDate. DataType is Date/Time.
  1. Add the new field to your forms record source AND add it to your form with a textbox. The textboxes control source is the PartOrderDate field.
  2. Format it as Short Date
  3. With the Parts Ordered On Click Event, add the following lines
Code:
Me.PartOrderDate=Date()
This code will add todays date to the PartOrderDate field when the user clicks the Parts Ordered CheckBox. That's the only way you will ever know which parts are ordered on which day.
 
when i tick parts ordered box the date comes into the box
I usually do it a different way. Instead of a checkbox, I just use a textbox called OrderDate or DateOrdered. If it's blank, the part hasn't been ordered yet. When there's a date in it, then it means the part was ordered on that date. So, all the use has to do is enter a date in that textbox when they order the part.
 

Users who are viewing this thread

Back
Top Bottom