Input Form

  • Thread starter Thread starter Frank Situmorang
  • Start date Start date
F

Frank Situmorang

Hello,

I have a data input form with field: Marital Status: with value list A, B,
C, D
And then I have a Mariage date field to fill.
A above means Married. My question is how can we make that if Marital status
is "A". Marriage field should not be left blank.

Thanks for any help.
 
Frank Situmorang said:
Hello,

I have a data input form with field: Marital Status: with value list A, B,
C, D
And then I have a Mariage date field to fill.
A above means Married. My question is how can we make that if Marital
status
is "A". Marriage field should not be left blank.

Thanks for any help.


In the BeforeUpdate event procedure of the form ...

If Me.MaritalStatus = "A" Then
If IsNull(Me.MarriageDate) Then
MsgBox "Please enter the marriage date"
Cancel = True
End If
End If
 
hi Frank,

Frank said:
I have a data input form with field: Marital Status: with value list A, B,
C, D
And then I have a Mariage date field to fill.
A above means Married. My question is how can we make that if Marital status
is "A". Marriage field should not be left blank.
You can either use the Change event of your control or the Before Update
event of the form, e.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Not IsNull(Me![MartialStatus]) And IsNull(Me![MariageDate]) Then
Me![MariageDate] = Date()
End If

End Sub



mfG
--> stefan <--
 
Thanks Stefan and all, I will try your suggestion.

--
H. Frank Situmorang


Stefan Hoffmann said:
hi Frank,

Frank said:
I have a data input form with field: Marital Status: with value list A, B,
C, D
And then I have a Mariage date field to fill.
A above means Married. My question is how can we make that if Marital status
is "A". Marriage field should not be left blank.
You can either use the Change event of your control or the Before Update
event of the form, e.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Not IsNull(Me![MartialStatus]) And IsNull(Me![MariageDate]) Then
Me![MariageDate] = Date()
End If

End Sub



mfG
--> stefan <--
 
Back
Top