-2

I have 3 checkbox at ms access and i want to put specific number to number field when each one of them is checked, for example

PcType as Number
type1  check1, type2 check2, type3 check3

when:

type1 checked -> PcType = 1

type2 checked -> PcType = 2

type1 & type2 checked -> PcType = 4

and so on..

MJH
  • 2,301
  • 7
  • 18
  • 20
  • Dear check this https://stackoverflow.com/questions/3813760/determine-whether-a-access-checkbox-is-checked-or-not also https://support.office.com/en-us/article/Add-a-check-box-control-to-show-Yes-No-values-4fa55fff-b3a0-4d03-a7a6-a2cfe4d03d4c – Ahmad Samilo Oct 16 '16 at 13:02
  • Thank you dear, but unfortunately still didn't got the answer – muhammad Hassan Oct 19 '16 at 11:50

1 Answers1

0
If Me.Type1 = True and Me.Type2 = False Then
    PCType = 1
ElseIf Me.Type2 = True and Me.Type1 = False Then
    PCType = 2
ElseIf Me.Type1 = True and Me.Type2 = True Then
    PCType = 4
ElseIf ... <further conditions go here>
End If    

This is going on the assumption that you want to hardcode the value of PCType for every single different scenario (i.e. setting a different PCType value for when only check1 and check3 are ticked, another unique value when all three are ticked etc)

You can also simplify it further by using branching if statements:

If Me.Type1 = True Then
    If Me.Type2 = False Then
        PCType = 1
    ElseIf ...
    End If
End If

However it's hard to give examples of this based on the information you have given.

finjo
  • 366
  • 4
  • 19