Input Form

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.
 
B

Brendan Reynolds

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
 
S

Stefan Hoffmann

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 <--
 
F

Frank Situmorang

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 <--
 

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