Results 1 to 13 of 13
  1. #1
    Join Date
    May 2009
    Posts
    72

    Unanswered: checkbox problems

    hi everybody
    iam a newbee in ms access .iam trying to make a payment processing database.
    i have landed up in trouble with using a checkbox.
    the problem is
    theres a textbox "amount pending"
    another textbox is "amount recieved"
    i have a checkbox called "status"
    i want the checkbox to be ticked if "amount pending" = "amount recieved"

    any help will be appreciated
    thanks in advance

    hemanth

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    theres a textbox "amount pending"
    another textbox is "amount recieved"
    i have a checkbox called "status"
    i want the checkbox to be ticked if "amount pending" = "amount recieved"
    I assume you want this to happen when Amount received is ticked

    You would need something like this

    If (Me![amount pending]=true) and (Me![amount received]=true) then
    me!status=true
    else
    me!status=false
    end if

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Simply:

    Code:
    If Me![amount pending] = Me![amount received] Then
       me!status=true
    Else
       me!status=false
    End if
    In the AfterUpdate event procedure for both values.

    You'd probably want to Lock the checkbox too.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    May 2009
    Posts
    72

    Thanks

    Thankks a lot for your valuable time and suggestion.
    I want the checkbox to be automatically ticked when the "amount pending" equals "amount recieved"
    i enterd the code in my afterupdate event for both the textbox.
    It dosent seem to work
    please help

    hemanth
    Last edited by krishnanhemanth; 05-26-09 at 11:28.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    With nothing to go on, all I can suggest is to check the spelling of your form objects (the Name property for the text boxes) and consolidate the spelling to the code.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    First
    another textbox is "amount recieved"
    in the examples provided note the spelling you have recieved and the examples has received

    Second, Startrekker's example is simpler but it will work for the following;-
    When Amount Pending and Amount Received are ticked then Status will be ticked this meets your requirement.

    But, it will not work for the following when after your updating suppose Amount Received and Amount Pending have a condition where they are both unticked then the Status checkbox would be ticked this does not meet your requirement.

    You will need something like this.
    If Me![amount pending] = True And Me![amount received] = True Then
    Me!status = True
    Else
    Me!status = False
    End If

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    PS, those fields are text boxes, not checkboxes. [Amount Pending] is a value, not a true/false.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    May 2009
    Posts
    72

    thanks again

    I think i was at fault in not making myself very clear about the problem.
    let me try to rephrase

    i have a txt box ---"AMOUNT PENDING" -- it gets its value form the subform
    another txtbox-----"AMOUNT RECIEVED"--THIS TOO GETS ITS VALUE FROM THE SUBFORM

    I HAVE A CHECKBOX BOUND TO A TABLE

    ALL I NEED IS THAT IF THE VALUE IN "AMOUNT RECIEVED" EQUALS "AMOUNT PEDING" THEN THE CHECKBOX SHOULD BE AUTOMATICALLY TICKED.

    thanks again
    hemanth

  9. #9
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Well, one way would be to make the checkbox based on an expression rather than a field. In the control source you could have:

    =IIf([Amount Pending]=[Amount Received],True,False)
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  10. #10
    Join Date
    May 2009
    Posts
    72

    thanks again

    HI Star
    Iam really not able to get this thing around
    i cannot change the checkbox to unbound
    its bound to a table.
    please is there any way to see that the checkbox gets populated automatically.

    thanks again star for your valuable time and suggestion

  11. #11
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Ok, so now you have a problem which is caused by the desire to store a value that should only ever be calculated.

    The code in post 3 applies, but the problem is WHEN to execute it. It can't be after update because it is never updated. Pity there is no afterupdate for a subform object.

    You could try subform_Exit and Form_Current... not sure as I just recalculate such fields, I don't try to store them. Every time I have tried to store a value that should be calculated, I end up removing it down the track. They are just sooo problematic.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  12. #12
    Join Date
    May 2009
    Posts
    72

    hi star

    still dosent seem to workout.
    is it possible this way

    a textbox "BALANCE" returns a calculateD VALUE
    txtboxAMOUNTPENDING minus txtboxAMOUNTRCVD = txtboxBALANCE

    IS IT POSSIBLE TO TICK THE CHECKBOX AUTOMATICALLY IF THE txtboxBALANCE BECOMES ZERO

    thanks in advance
    hemanth

  13. #13
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Changes nothing.

    The basic issue is you are trying to STORE something that should just be CALCULATED.

    The only way to do it is as already stated. It is up to you to find the right "trigger" ... when to run the code.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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