Hi all,
As per the subject I'm attempting to make Text104 mandatory if any of a series of other fields contains a value.
So far I have:
and this:
The text after update events work fine, so if a user inputs data into any of the text boxes and text104 is null it warns and sets focus.
The problem is you can then leave text104 without putting a value in.. which is where i'm stuck.
Appreciate the help
Edit: I also get an invalid use of Null when I try and enter design view, this is associated with the form BeforeUpdate line
As per the subject I'm attempting to make Text104 mandatory if any of a series of other fields contains a value.
So far I have:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim addlength As Integer
addlength = Len([Text106] & [Text108] & [Text110] & [Text112] & [Text114] & [Text116])
If addlength > 0.5 Then
If IsNull([Text104]) Then
MsgBox "Accounts address Line 1 cannot be blank", vbOKOnly, "Form Not complete"
[Text104].SetFocus
End If
End If
End Sub
Code:
Private Sub Text106_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub Text108_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub Text110_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub Text112_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub Text114_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub Text116_AfterUpdate()
Call CheckAccountsAddress
End Sub
Private Sub CheckAccountsAddress()
If IsNull(Me.[AccountsAddress Line1]) Then
MsgBox "Acc Address Line 1 cannot be empty", vbOKOnly, "Address Incomplete"
[Text104].SetFocus
End If
End Sub
The problem is you can then leave text104 without putting a value in.. which is where i'm stuck.
Appreciate the help
Edit: I also get an invalid use of Null when I try and enter design view, this is associated with the form BeforeUpdate line
Code:
addlength = Len([Text106] & [Text108] & [Text110] & [Text112] & [Text114] & [Text116])
Last edited: