Required Field based on another field

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I have 3 fields: Name, Date Sent, Recipient.
How do I require them to fill in the "Recipient" when they
fill out the "date sent"?

Also, is there a way to "auto -date stamp" a field based
on when they choose an item from a drop down box?

Thanks for your help!
 
For a rule that involves comparing fields, use the Validation Rule of the
table, not that of a field.
1. Open the table in Design view.
2. Open the Properties box (View menu).
3. Beside the Validation Rule in the Properties box, enter:
([date sent] is null) OR ([recipient] is not null)
Then the rule is satisfied if the rule is blank. If the date is not blank,
the only other way the rule can be satisified is if recipient has an entry.

You can only record the last update date if entries are made using a form.
Use the BeforeUpdate event of the form to set the value of the date/time
field:

Private Sub Form_BeforeUpdate(Cancel As Integer)
With Me.MyCombo
If Nz(.Value) <> Nz(.OldValue) Then
Me.[NameOfYourDateFieldHere] = Now()
End If
End With
End Sub
 
First off, Thank you very much. It works perfect. I know I
should have thought about this the first time but what if
it's reversed. What if they fill out Recipient and not
date sent?
Sorry for not thinking about that the first time around.
-----Original Message-----
For a rule that involves comparing fields, use the Validation Rule of the
table, not that of a field.
1. Open the table in Design view.
2. Open the Properties box (View menu).
3. Beside the Validation Rule in the Properties box, enter:
([date sent] is null) OR ([recipient] is not null)
Then the rule is satisfied if the rule is blank. If the date is not blank,
the only other way the rule can be satisified is if recipient has an entry.

You can only record the last update date if entries are made using a form.
Use the BeforeUpdate event of the form to set the value of the date/time
field:

Private Sub Form_BeforeUpdate(Cancel As Integer)
With Me.MyCombo
If Nz(.Value) <> Nz(.OldValue) Then
Me.[NameOfYourDateFieldHere] = Now()
End If
End With
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Keith said:
I have 3 fields: Name, Date Sent, Recipient.
How do I require them to fill in the "Recipient" when they
fill out the "date sent"?

Also, is there a way to "auto -date stamp" a field based
on when they choose an item from a drop down box?

Thanks for your help!


.
 
Try a table validation rule of:
([date sent] Is Null AND [recipient] Is Null) OR ([date sent] Is Not Null
AND [recipient] Is Not Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Keith said:
First off, Thank you very much. It works perfect. I know I
should have thought about this the first time but what if
it's reversed. What if they fill out Recipient and not
date sent?
Sorry for not thinking about that the first time around.
-----Original Message-----
For a rule that involves comparing fields, use the Validation Rule of the
table, not that of a field.
1. Open the table in Design view.
2. Open the Properties box (View menu).
3. Beside the Validation Rule in the Properties box, enter:
([date sent] is null) OR ([recipient] is not null)
Then the rule is satisfied if the rule is blank. If the date is not blank,
the only other way the rule can be satisified is if recipient has an entry.

You can only record the last update date if entries are made using a form.
Use the BeforeUpdate event of the form to set the value of the date/time
field:

Private Sub Form_BeforeUpdate(Cancel As Integer)
With Me.MyCombo
If Nz(.Value) <> Nz(.OldValue) Then
Me.[NameOfYourDateFieldHere] = Now()
End If
End With
End Sub

Keith said:
I have 3 fields: Name, Date Sent, Recipient.
How do I require them to fill in the "Recipient" when they
fill out the "date sent"?

Also, is there a way to "auto -date stamp" a field based
on when they choose an item from a drop down box?

Thanks for your help!
 
([date sent] Is Null AND [recipient] Is Null) OR ([date sent] Is Not
Null AND [recipient] Is Not Null)

([Date Sent] Is Null) = ([Recipient] Is Null)


Tim F
 
Back
Top