Compulsary field - user must enter a date

  • Thread starter Thread starter RitchieJHicks
  • Start date Start date
R

RitchieJHicks

Hi,

I have a field called DiaryDate and one called File Status. Within my File
Status field there are 5 options (Closed, Pending, Active, Rejected and Sols).

My problem is that I want to make the user forced to enter a date in the
DiaryDate field, if the Status field is set to anything other than Closed.
And pop a message saying something like "You MUST enter a diary date before
closing".

Is this possible?

Thanks,
Ritchie.
 
Hi -

Try putting something like this in the Before Update event of the form:

if me![File Status] <> "Closed" and isnull (me![diaryDate]) then
msgbox "You must enter a diarydate...."
docmd.gotocontrol "DiaryDate"
Cancel = -1
endif

If the record is new, you might need to use the Before Insert event instead.

John
 
That's excellent, thank you. It works a treat.

J_Goddard via AccessMonster.com said:
Hi -

Try putting something like this in the Before Update event of the form:

if me![File Status] <> "Closed" and isnull (me![diaryDate]) then
msgbox "You must enter a diarydate...."
docmd.gotocontrol "DiaryDate"
Cancel = -1
endif

If the record is new, you might need to use the Before Insert event instead.

John


Hi,

I have a field called DiaryDate and one called File Status. Within my File
Status field there are 5 options (Closed, Pending, Active, Rejected and Sols).

My problem is that I want to make the user forced to enter a date in the
DiaryDate field, if the Status field is set to anything other than Closed.
And pop a message saying something like "You MUST enter a diary date before
closing".

Is this possible?

Thanks,
Ritchie.
 
Back
Top