Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2004
    Posts
    86

    Unanswered: Making checkboxes priorty over others

    Hi
    My db is below
    http://emotiveexposed.mysite.wanadoo...co.uk/test.mdb

    i have a series of checkboxes in sections

    Compliance and Quality

    here is my required scenario
    what i want is if compliance checkbox.value = 1 then flagawarded = "Red Flag"
    else "n/a"
    if quality checkbox.value = 1 then flagawarded = "amber flag"
    but if both compliance checkbox.value = 1 AND quality.value = 1 then flagawarded = "Red Flag"
    so that red flags are priorty over amber flags even tho they are both ticked

    also related to this question how can i get evaluationscore.value = "n/a" if flagawarded = "Red Flag"

    thank you

  2. #2
    Join Date
    Oct 2004
    Posts
    86
    can anyone help me with this at all please?
    thank you i appriciate any help

  3. #3
    Join Date
    Sep 2003
    Posts
    228
    Code:
    me.flagawarded = "n/a"
    If Me.QUALITY.Value = True Then
       me.flagawarded = "Amber Flag"
    endif
    If Me.COMPLIANCE.Value = True Then
       me.flagawarded = "Red Flag"
    endif
    By checking quality first and compliance second, the red flag will always overwrite the amber flag. The flag is initialized as "n/a" and only set to red or amber if one or both of the checkboxes are checked.

    I would put this code in a function and call that function when either checkboxes are changed (onchange event). And if needed in the on current event when, for when the record changes you set up your form.

    also related to this question how can i get evaluationscore.value = "n/a" if flagawarded = "Red Flag"
    set evalscore.value = "n/a" right after you set the flag to red.

  4. #4
    Join Date
    Oct 2004
    Posts
    86
    there is no onchange event for checkboxes, i need some more complex structure to the if statements

    scenario:

    if compliance = 1 then flagawarded = "red flag" and totalevaluationscore = "n/a"

    if compliance = 1 and quality = 1 then flagawarded = "red flag" and totalevaluationscore = "n/a"

    if compliance = 0 and quality = 1 then flagawarded = "amber flag" and total evaluation score = "the calculated value it should be based on my sub precedure"

    if compliance = 0 and quality = 0 then flagawarded = "None" and total evaluation score = "90"

    these are the four possiblities, however i need these rules to apply at all times as the checkboxes can be unclicked (i.e if they were clicked accidentally)

    can anyone tell me how i can structure this and where i would put the code based on my db

    thank you

  5. #5
    Join Date
    Sep 2003
    Posts
    228
    checkboxes have an afterupdate event. it would benefit you to create a function that checks the status of the checkboxes and sets the flag accordingly.
    You can call this function from all checkbox's afterupdate event and on the form's oncurrent event

    Code:
    Function Set_Flag_and_Score()
     flagawarded = "None" 
     total evaluation score = "90"
    
     if quality = 1 then 
        flagawarded = "amber flag" 
        total evaluation score = sub_precedure()
     EndIf
    
     if compliance = 1 then 
        flagawarded = "red flag" 
        totalevaluationscore = "n/a"
     EndIf
    End Function
    
    Function myCheckbox_AfterUpdate()
       Call Set_Flag_and_Score
    End Function
    What's the problem...? Why will this solution not work for you?

  6. #6
    Join Date
    Oct 2004
    Posts
    86
    ive sorted it,

    i followed your advice

    thank you for your help

    but now.... i have another thing im stuck with, see my latest post if you could help

    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •