I have two fields on my form:
- HoldFor is a CheckBox field
- ProjectID is a Text field
I have the following code:
Problem:
- Does not work %-)
What I see:
- When I set the first line of the IF statement for Debug I can see that [HoldFor] is True and [ProjectID] is Null by mousing over them. I then continue running the code and none of the subsequest code gets executed. I am not sure why since both tests are true.
I basically want the user to have to put text into the [ProjectID] field if [HoldFor] is checked. If there is a better way to do this than the way I am trying to, please let me know. I have thought about a validation rule in the controls or underlying table, but I do not know how to implement that properly.
Thanks in advance for any help.
James
- HoldFor is a CheckBox field
- ProjectID is a Text field
I have the following code:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me![HoldFor] = True And [ProjectID] = Null Then
DoCmd.RunMacro("mcrReserved") ' Displays warning message
DoCmd.GoToControl "ProjectID"
Cancel = True
End If
End Sub
- Does not work %-)
What I see:
- When I set the first line of the IF statement for Debug I can see that [HoldFor] is True and [ProjectID] is Null by mousing over them. I then continue running the code and none of the subsequest code gets executed. I am not sure why since both tests are true.
I basically want the user to have to put text into the [ProjectID] field if [HoldFor] is checked. If there is a better way to do this than the way I am trying to, please let me know. I have thought about a validation rule in the controls or underlying table, but I do not know how to implement that properly.
Thanks in advance for any help.
James