verify a date in a subform

G

Guest

I have a parent form and a subform in datasheet view.

The User clicks on an option radio button in the parent form to select a
current status. When user clicks on one specific status, I want an event to
check that a date is valid in the SUBFORM (valid meaning either NOT null or
not an empty string). Users can go in at any time and add or delete a date
in this field, so I think that my code needs to understand that it can be
null or empty, correct?

So, I tried using a macro in the AFTER UPDATE event on the OptionFrame, but
that only seems to work when I have clicked in the subform; when I don't move
around in the subform first, it doesn't work. The conditions of my macro are
below. Is there another way I should approach this?

Condition:
[Forms]![frmupdatecaseentry]![CaseStatus]=6 And
[Forms]![frmupdatecaseentry]![fromCaseFeatureSubform].[Form]![FeatureDateClosed]
Is Null Or
[Forms]![frmupdatecaseentry]![fromCaseFeatureSubform].[Form]![FeatureDateClosed]=""

Msgbox and StopMacro
 
G

Guest

Use the main form UnLoad event

Private Sub Form_Unload(Cancel As Integer)
If Me.[CaseStatus]=6 And
(Me.[fromCaseFeatureSubform].[Form]![FeatureDateClosed] & "") = "" Then
MsgBox "Must enter FeatureDateClosed"
Cancel = True 'wont let the user close the form
End If
 

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