J
JimS
I asked a similar question recently, got no answers. I rebuilt the form
(Header/detail) using the wizard, this time with the final form name I wanted.
I added three buttons, and a couple of event handlers. One of the event
handlers in the subform is acting strangely (BeforeUpdate). I set a
breakpoint in it (I tried the simple way--edit via main form, the hard
way--edit subform separately, same result). The event is firing, because
debug.print statements are showing up.
I just can't get it to break. When I hit F9, the line turns color. When I
hit it again, it turns color again. There is no rhyme or reason. I'm getting
very frustrated. In additon, the comparisons aren't working right (always
showing <> as true...) Code shown below.
---------------------------------Code----------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me.cbWOID, "") <> "" Then
Debug.Print "(0)=" & Me.cbWOID.Column(0) & "(1)=" &
Me.cbWOID.Column(1) & "(2)=" & Me.cbWOID.Column(2) & "(3)=" &
Me.cbWOID.Column(3) & "(4)=" & Me.cbWOID.Column(4)
Dim boolOK As Boolean
boolOK = True
If Nz(POMICAPID, 0) <> Nz(Me.cbWOID.Column(2), 0) Then
Debug.Print Nz(POMICAPID, 0), Nz(Me.cbWOID.Column(2), 0)
MsgBox "MICAP doesn't match WO!"
boolOK = False
End If
If Nz(Me.Discipline, 0) <> Nz(Me.cbWOID.Column(3), 0) Then
Debug.Print Nz(Me.Discipline, 0), Nz(Me.cbWOID.Column(3), 0)
MsgBox "Discipline doesn't match WO!"
boolOK = False
End If
If Nz(Me.ProjectID, 0) <> Nz(Me.cbWOID.Column(4), 0) Then
Debug.Print ProjectID, cbWOID.Column(4)
MsgBox "Project doesn't match WO!"
boolOK = False
End If
If Not boolOK Then
Dim response As VbMsgBoxResult
response = MsgBox("Continue?", vbYesNo, "Fields don't match
WorkOrder")
If response <> vbYes Then
Cancel = True
End If
End If
End If
End Sub
------------------------------End Code-----------------------
Ideas?
(Header/detail) using the wizard, this time with the final form name I wanted.
I added three buttons, and a couple of event handlers. One of the event
handlers in the subform is acting strangely (BeforeUpdate). I set a
breakpoint in it (I tried the simple way--edit via main form, the hard
way--edit subform separately, same result). The event is firing, because
debug.print statements are showing up.
I just can't get it to break. When I hit F9, the line turns color. When I
hit it again, it turns color again. There is no rhyme or reason. I'm getting
very frustrated. In additon, the comparisons aren't working right (always
showing <> as true...) Code shown below.
---------------------------------Code----------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me.cbWOID, "") <> "" Then
Debug.Print "(0)=" & Me.cbWOID.Column(0) & "(1)=" &
Me.cbWOID.Column(1) & "(2)=" & Me.cbWOID.Column(2) & "(3)=" &
Me.cbWOID.Column(3) & "(4)=" & Me.cbWOID.Column(4)
Dim boolOK As Boolean
boolOK = True
If Nz(POMICAPID, 0) <> Nz(Me.cbWOID.Column(2), 0) Then
Debug.Print Nz(POMICAPID, 0), Nz(Me.cbWOID.Column(2), 0)
MsgBox "MICAP doesn't match WO!"
boolOK = False
End If
If Nz(Me.Discipline, 0) <> Nz(Me.cbWOID.Column(3), 0) Then
Debug.Print Nz(Me.Discipline, 0), Nz(Me.cbWOID.Column(3), 0)
MsgBox "Discipline doesn't match WO!"
boolOK = False
End If
If Nz(Me.ProjectID, 0) <> Nz(Me.cbWOID.Column(4), 0) Then
Debug.Print ProjectID, cbWOID.Column(4)
MsgBox "Project doesn't match WO!"
boolOK = False
End If
If Not boolOK Then
Dim response As VbMsgBoxResult
response = MsgBox("Continue?", vbYesNo, "Fields don't match
WorkOrder")
If response <> vbYes Then
Cancel = True
End If
End If
End If
End Sub
------------------------------End Code-----------------------
Ideas?