Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: Refresh of Text box before validation

    Hi,
    I have a continuous form (filtered form a parent form) and in the detail section is an option group (2 options, Master or Slave. The user can chose to select an option or not.

    I have to check the following;
    1) Allow no selection to take place
    2) Ensure that only one Master is selected over the group of records
    3) Ensure that at least one Slave option is selected if a master is selected
    4) Ensure that if a Slave option is selected, then 1 Master option must also be selected.

    To make these true I have (probably far too long winded) allocated the value of Master to -100 and Slave 2. Using these values I have created a text box in the footer and use the DSum function to total all these values up. The the form exit button is linked to a macro via OnClick that checkes the 4 scenarios above are true, if they are not a message box appears and the user is re-resented with the form for amendment.

    This all works fine except that the text box that holds the DSum function does not update staright away. For example, if the user selects only 2 Master options the macro correctly tells the user that he has made 2 Master selections, but if the user then inadvertantly selects 2 Slaves the marco again displays the message box that 2 Masters have been selected followed by the message that 2 Slaves have been selected.

    My question is, how can I get the text box that holds the Dsum totals to update first and then the condition in the macro is evaluated?

    Regards
    John

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Refresh of Text box before validation

    Originally posted by Sticker
    Hi,
    I have a continuous form (filtered form a parent form) and in the detail section is an option group (2 options, Master or Slave. The user can chose to select an option or not.

    I have to check the following;
    1) Allow no selection to take place
    2) Ensure that only one Master is selected over the group of records
    3) Ensure that at least one Slave option is selected if a master is selected
    4) Ensure that if a Slave option is selected, then 1 Master option must also be selected.

    To make these true I have (probably far too long winded) allocated the value of Master to -100 and Slave 2. Using these values I have created a text box in the footer and use the DSum function to total all these values up. The the form exit button is linked to a macro via OnClick that checkes the 4 scenarios above are true, if they are not a message box appears and the user is re-resented with the form for amendment.

    This all works fine except that the text box that holds the DSum function does not update staright away. For example, if the user selects only 2 Master options the macro correctly tells the user that he has made 2 Master selections, but if the user then inadvertantly selects 2 Slaves the marco again displays the message box that 2 Masters have been selected followed by the message that 2 Slaves have been selected.

    My question is, how can I get the text box that holds the Dsum totals to update first and then the condition in the macro is evaluated?

    Regards
    John
    John,

    A better way to do this is to have 2 hidden columns (1 for master and 1 for slave) that upon the After_Update method you set those columns to 1 for either the master or slave ... Then do the DSum on those 2 columns (1 for master and 1 for slave) and act accordingly ...

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Mike
    Thanks for the reply

    Done as you say and used the AfterUpdate to populate to 2 new columns, this works fone, BUT the DSum does not refresh to encompass any changes.

    Is there a way I can incorparate the afterdate to encompass refreshing the DSum text box?

    Cheers
    John

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Sticker
    Hi Mike
    Thanks for the reply

    Done as you say and used the AfterUpdate to populate to 2 new columns, this works fone, BUT the DSum does not refresh to encompass any changes.

    Is there a way I can incorparate the afterdate to encompass refreshing the DSum text box?

    Cheers
    John
    Couple things John:

    After_Update will write to the hidden columns ... The Form_Update is where you need to run the DSum ... Remember that form_update is the event that fires when the record is written/updated ... Until that event fires there is no change to the underlying tables ... BTW, at what point does your macro fire?

  5. #5
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Mike,
    The marco fires when you exit the form and your reply has just given me an idea, if I put a line in the macro of Requery at the beginning it seems to work, that probably isn't the cleanest way of doing it but it seems to solve the issue!!

    Thanks for the tip about the form update, I hadn't realised that, so it should help me in another area I have an issue.

    Thanks once again for your time

    Regards
    John

Posting Permissions

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