Required Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to make a listbox field required based on the value of a checkbox. In
other words if the user checks the field F1, then field F2 becomes required.
How do I do this?
 
Hi Morticia

On the before update event of the form, write the code that check if the F1
is true ad there is value in F2

If Me.[F1] = True And (IsNull(Me.[F2]) Or Trim(Me.[F2]="") ) Then
MsgBox "F2 must be filled"
Me.[F2].SetFocus
Cancel = True 'wont allow the user move to the next record
End If
 
That was exactly what I needed, except that I couldn't get it to set the
focus back to F2. That's OK - I have what I wanted. Thanks!
--
Morticia


Ofer said:
Hi Morticia

On the before update event of the form, write the code that check if the F1
is true ad there is value in F2

If Me.[F1] = True And (IsNull(Me.[F2]) Or Trim(Me.[F2]="") ) Then
MsgBox "F2 must be filled"
Me.[F2].SetFocus
Cancel = True 'wont allow the user move to the next record
End If

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Morticia said:
I need to make a listbox field required based on the value of a checkbox. In
other words if the user checks the field F1, then field F2 becomes required.
How do I do this?
 
Glad I could help


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Morticia said:
That was exactly what I needed, except that I couldn't get it to set the
focus back to F2. That's OK - I have what I wanted. Thanks!
--
Morticia


Ofer said:
Hi Morticia

On the before update event of the form, write the code that check if the F1
is true ad there is value in F2

If Me.[F1] = True And (IsNull(Me.[F2]) Or Trim(Me.[F2]="") ) Then
MsgBox "F2 must be filled"
Me.[F2].SetFocus
Cancel = True 'wont allow the user move to the next record
End If

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


Morticia said:
I need to make a listbox field required based on the value of a checkbox. In
other words if the user checks the field F1, then field F2 becomes required.
How do I do this?
 
Back
Top