Joe Hecht
jmhla at earthlink.net
Tue Feb 22 20:40:30 CST 2005
The Scenario: The client wants yes and no check boxes on a report. On the form I have yes no check boxes on the form. Selecting both yes and no on the same group is a logic error. The problems: 1. The code only fires one time per form. 2. After it triggers and you click ok it goes to the next product. On clicking the ok button I need to stay on the same record. a. Am I using the wrong event? b. I tried using the me.currentrecord but could not find a way to write the code. 3. I have two fields for each item. If there is one yes/no field on the form is there code to mark yes and no boxes on the report. The code follows. Thanks Joe I Private Sub Form_BeforeUpdate(pintCancel As Integer) Dim lngRetval As Long If txtProdMatCert = True And txtProdMatCertn = True Then lngRetval = MsgBox( _ "You have selected both YES and No for Material Certificationthis item." & vbCrLf & "Please select Yes or No.", _ vbOKOnly + vbCritical + vbDefaultButton1, _ "Coflicting Yes No Message") Select Case lngRetval Case vbOK End Select End If If ProdSpecialCertification = True And ProdSpecialCertification = True Then lngRetval = MsgBox( _ "You have selected both YES and No for Special Process Certification." & vbCrLf & "Please select Yes or No.", _ vbOKOnly + vbCritical + vbDefaultButton1, _ "Coflicting Yes No Message") Select Case lngRetval Case vbOK End Select End If 'TVCodeTools ErrorHandlerStart PROC_EXIT: Exit Sub PROC_ERR: MsgBox Err.Description Resume PROC_EXIT 'TVCodeTools ErrorHandlerEnd End Sub