[AccessD] Code Issues Again

Michael Maddison michael at ddisolutions.com.au
Tue Feb 22 22:06:28 CST 2005


Joe,
cant you do something like this?

regards

Michael M


Private Sub Form_BeforeUpdate(pintCancel As Integer)
    
    Dim lngRetval As Long
    
    If txtProdMatCert = True And txtProdMatCertn = True Then
        
        
        MsgBox "don't do that!"
	pintCancel = 1
	'Only test once if true
        exit sub

        
    End If
    
            If ProdSpecialCertification = True And
ProdSpecialCertification = True Then
   	 	If txtProdMatCert = True And txtProdMatCertn = True Then
        
        
        		MsgBox "don't do that either!"
		pintCancel = 1
            End If
            
    
    'TVCodeTools ErrorHandlerStart
PROC_EXIT:
    Exit Sub
    
PROC_ERR:
    MsgBox Err.Description
    Resume PROC_EXIT
    'TVCodeTools ErrorHandlerEnd
    
End Sub
 
 
 
 
 
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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list