On "dirty" or on "click"

Needhlp

Registered User.
Local time
Today, 11:36
Joined
Oct 18, 2007
Messages
28
I have a date field preceeded by a Yes/No box.

The users click the Yes/No box if for an example there has been a mistake involving the import of a shipment. The broker has to click on the box if the condition is Yes (Failed). I want the users to fill the date that they reported the mistake to customs. But, I don't want to allow changes to the date once entered. How can I set this expression in the Expression builder menu.
I have tried "On dirty" [Now] but the user can still change the date (they tense to cheat to make themselves look better!)

Any idea. Not very knowledgeable with macros!

JO
 
#1 dont use Macro's use code.. :)

Use the On Click event of the "yes/no" box to fill in the Now() in the datefield.

To "lock" the field / block it from beeing editted... Set the "locked" property to Yes...
Alternatively you can set one of the following properties
"Enabled" to No
"Visible" to no (tho this hides the field completely from the user, dont know if you want that)

Also you can use one of the following events
"on key press"
"on change"
"On Change"
"On enter"
"On Got Focus"
To limit the users access to the control and/or prompt that user that "this is not allowed"

Good luck !

Post back any questions you still have :)
 
This looks good if you want the "today's" date and you do not want users to be able to see or enter the date by themselves but in my case, the brokers have to enter the date that they notified Customs.
Would there be an expression "not allowing" them to change the date that they have entered once the field has been populated?
It goes like this:
Field 6: FAILED: Yes/No
Field 7: Date customs was notified: mm/dd/yyyy

If 6 is true, the on "dirty" lock 7 or something like that?
 
Well in any of the events you can check if the field is filled or not.
If it is (still) empty, allow data entry...

If it is allready filled... block it.
You can use i.e. On Got Focus perfectly for that scenario
 
This will do the job. Once the date is entered and the record saved, either by clicking a "Save" button, moving to another record, or closing the form, the control will be locked. Just plug in your textbox name where DateReported appears.

Code:
Private Sub Form_Current()
  If Not IsNull(Me.DateReported) Then
    Me.DateReported.Locked = True
  Else
    Me.DateReported.Locked = False
  End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom