Compulsary field - user must enter a 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.
 
J

J_Goddard via AccessMonster.com

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
 
R

RitchieJHicks

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top