Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38

    Unanswered: problem with checkbox using VB code

    Hi I have a order form where if the total value is the same as the ordered value i would like a checkbox to tick it self to state the order has been complete

    the code i am using is as follows:

    Private Sub Text19_Change()

    If Forms![order1]![Text19] = 0 Then

    Me.Parent!OrderComplete = True
    Else
    Me.Parent!OrderComplete = False
    End If
    End Sub

    text19 is the textbox on the subformform it is not linked to a table it is just used on the form. it is used so it can help users by letting them no how many items have been delivered. A checkbox(ordercomplete) is on the main form which i am hoping by using the code if the total delivered equals 0 (meaning order complete) the checkbox will be set to yes.

    However nothin work at present

    any suggestion will be helpfull

    many thanks
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Prube this two change:
    Me.Parent!OrderComplete = True for
    Forms![MyMainForm]![OrderComplete] = True
    Me.Parent!OrderComplete = False for
    Forms![MyMainForm]![OrderComplete] = False
    And tell me if works
    Saludos
    Norberto

  3. #3
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38
    Hi i have done what you said and it has not made any changes,

    here is the code i am using now:


    Private Sub Text19_Change()

    If Forms![order1]![Text19] = 0 Then

    Forms![MyMainForm]![OrderComplete] = True

    Else
    Forms![MyMainForm]![OrderComplete] = False

    End If
    End Sub

    many thanks in advance
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    The name [MyMainForm] must be the name of your form main that who have the field [OrderComplete] you understant me.
    Saludos
    Norberto

  5. #5
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38
    here is the code i am using now and i still get the same problem :-(

    Private Sub Text19_Change()

    If Forms![order1]![Text19] = 0 Then

    Forms![order]![OrderComplete] = True
    Else
    Forms![order]![OrderComplete] = False

    End If
    End Sub


    Not sure what could be wrong have been stuck on this problem for a few dayes now

    regards
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

  6. #6
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Put the code in the event AfterUpdate
    Saludos
    Norberto

  7. #7
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38
    still no change anymore suggestions

    Private Sub Text19_AfterUpdate()
    If Forms![order1]![Text19] = 0 Then

    Forms![order]![OrderComplete] = True
    Else
    Forms![order]![OrderComplete] = False

    End If
    End Sub

    thank you for all your help

    really apprecitate it
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

  8. #8
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Ok.. send me a zip sample base in Access 97 format and i see what is the problem then i send to you, is more easy this way....
    Saludos
    Norberto

  9. #9
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38
    here is a copy of the database you will need to click on the form orde to go in the order form
    Attached Files Attached Files
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

  10. #10
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    I must do some change, in the event update or change of Text19 never work the code because is a calculate control.
    I put the code in the event AfterUpdate of the form, and work fine:

    Private Sub Form_AfterUpdate()
    Me.Recalc
    If Me.Text19 = 0 Then

    Forms![Order]![OrderComplete] = True


    Else
    Forms![Order]![OrderComplete] = False

    End If
    End Sub

    I send your base with the update.
    Attached Files Attached Files
    Saludos
    Norberto

  11. #11
    Join Date
    Dec 2003
    Location
    Derby, England
    Posts
    38
    hi

    Many many thanks for your help, it works perfectly now

    thanks once again

    kabir
    Kabir Hussein

    http://www.angelfire.com/theforce/precious/index.html

Posting Permissions

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