jeudi 3 décembre 2015

VBA Access make image visible or not visible based on multiple checkboxes

The following code turns an image on or off based on whether there are two checkboxes checked. The problem is as I add checkboxes only the last two work correctly. In the example below the image does not turn on and off if chk_Pipe1N and chkIn1 are both checked. However it works perfectly when chk_Pipe2N and chkIn2 are both checked. If I add chk_Pipe3N and chkIn3 it will work for this set, but set 1 and 2 no longer work. Any ideas why?

'NIn If Me.chk_Pipe1N Or Me.chk_Pipe2N And Me.chkIn1 Or Me.chkIn2 Then Me.imgNIN.Visible = True Else Me.imgNIN.Visible = False End If

'NOut If Me.chk_Pipe1N Or Me.chk_Pipe2N And Me.chkOut1 Or Me.chkOut2 Then Me.imgNOut.Visible = True Else Me.imgNOut.Visible = False End If




Aucun commentaire:

Enregistrer un commentaire