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

    Unanswered: checkboxes deducting values from default value

    Hi,

    I need a bit of help structuring the vb code for my checkboxes on a sub form

    i have attached the form and subform

    what i have is when checkboxes "agent name","telephone number","confirmed DMC" etc.. are click they make saluation box clicked and also checkbox "quality" clicked (see picture attachment)

    what i want is for when salutation has been given a tick from is child boxes i want a value taken from a box (with a default value of 100) but.... each time one of the child boxes are ticked it keeps deducting the value. i only want 20 removed from the default value if it has a tick in it see below code

    Option Compare Database
    Option Explicit

    Private Sub qsAgentsName_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True

    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If
    End If

    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub


    Private Sub qsTelephoneNumber_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True

    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If

    'make top header true if any boxes checked
    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub


    Private Sub qsAddress_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True

    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If

    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub

    Private Sub qsAffinityPartner_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True

    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If

    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub



    Private Sub qsConfirmedDMC_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True

    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If

    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub

    Private Sub qsHomeOwner_Click()
    If Me.qsAgentsName = True Or Me.qsTelephoneNumber = True Or Me.qsAffinityPartner = True Or Me.qsAddress = True Or Me.qsHomeOwner = True Or Me.qsConfirmedDMC = True Then
    Me.qSalutation.Value = True
    Else
    Me.qSalutation.Value = False

    End If

    'for Qualityscore
    If Me.qSalutation = True Then
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value - 20
    Else
    Forms!frmscreeningform.QualityScore.Value = Forms!frmscreeningform.QualityScore.Value + 20
    End If



    If Me.qSalutation.Value = True Or _
    Me.qAttitude.Value = True Or _
    Me.qProductAdvice.Value = True Or _
    Me.qLegalScripting.Value = True Or _
    Me.qProceduralAction.Value = True Then

    Me.QUALITY.Value = True

    Else
    Me.QUALITY.Value = False

    End If
    End Sub

  2. #2
    Join Date
    Oct 2004
    Posts
    86
    pic attached
    Attached Files Attached Files

Posting Permissions

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