Requiring entry in field 2 if if field 1 is checked

  • Thread starter Thread starter Perry Kew
  • Start date Start date
P

Perry Kew

Fields:
Regular (yes / no field)
Position (text field)

I have a checkbox called regular in an Access 2002
database. If this field is checked, I would like to have
access remind me that I have to fill the position field
and take me there.

Moreover, if regular has been checked is there any way to
make sure that I cannot move to the next record or save
the record without having something in the Position field.

I hope that this is not too difficult and it would save me
a lot of frustration. Can someone please help me with
this? Thank you.

--Perry
 
Put this code in the AfterUpdate event of the Regular Checkbox:

If Me!Regular = True Then
MsgBox "You must enter something in the Position field"
Me!Position.SetFocus
End If

Put this code in the BeforeUpdate event of your form:
If Me!Regular = True Then
If IsNull(Me!Position) Then
Msgbox "You can not close the form or go to a new record when Regular is
checked and no entry has been made in Position"
Cancel = True
Me!Position.SetFocus
End If
End If


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel
 
Back
Top