Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2004
    Posts
    277

    Unanswered: refreshing underlying form w/o name

    what am I trying to do is refresh the form that is underlying to a universal form.

    There will be one form either pickupsheet, frmQuote....

    which opens frmAddNewCarrier

    When done adding new carrier it will make visible the underlying form but i want it to refresh the form so the new carrier is added to the drop down lists on the form.

    Trying to work with the Forms Collections using Form(0) but doesn't seem to work. Any ideas?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if your first form has the event that loads the second form, try playing with
    Screen.ActiveForm
    in the second form's _Load() event.

    surprisingly .ActiveForm is still the first form during _Load() of the second form so you should be able to capture it there.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2004
    Posts
    277
    nah the second form is brought on by a command button... then you enter New Carrier Information and then return to the other form.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    a command button WHERE?

    if the button is on the form you are trying to talk to when you are done on the second form, it'll work.

    try it.

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Dec 2004
    Posts
    277
    sorry maybe i'm not detailed enough

    on one of these forms pickupsheet OR quote

    hit the AddNewCarrier button

    Opens AddNewCarrier form

    Enter New Carrier Information

    Hit DONE on AddNewCarrier form

    Now Refresh either the pickupsheet OR quote form

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    exactly the scenario you need !

    at the top of AddNewCarrier you need a form-wide var
    dim myForm as form

    in Form_Load() of AddNewCarrier
    set myForm = Screen.ActiveForm

    in Form_Unload() of AddNewCarrier
    myForm.Requery 'or whatever you are trying to do

    i haven't tried it with
    Screen.ActiveForm
    but i know it works with
    Screen.ActiveForm.AcitveControl 'NOT .ControlOnTheForm as earlier post
    so it ought to play with the form itself.

    izy
    Last edited by izyrider; 01-18-05 at 13:48. Reason: stupid error!
    currently using SS 2008R2

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Here's another method that I use:
    (this would even set the carrier on the first form to the value that you just entered)

    If SysCmd(acSysCmdGetObjectState, acForm, "pickupsheet") =acObjStateOpen Then
    Forms![pickupsheet]![cmbCarrier].Requery
    Forms![pickupsheet]![cmbCarrier].Value = txtCarrier
    ElseIf SysCmd(acSysCmdGetObjectState, acForm, "quote") = acObjStateOpen Then
    Forms![quote]![cmbCarrier].Requery
    Forms![quote]![cmbCarrier].Value = txtCarrier
    End If
    Inspiration Through Fermentation

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    hi RNG - good to have some competition.

    mine should work if both pickupsheet and quote are open, yours defaults to pickupsheet if both are open.

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Quote Originally Posted by izyrider
    hi RNG - good to have some competition.

    mine should work if both pickupsheet and quote are open, yours defaults to pickupsheet if both are open.

    izy
    touche! I wasn't paying attention to the code I copied.

    It should read like this....

    If SysCmd(acSysCmdGetObjectState, acForm, "pickupsheet") =acObjStateOpen Then
    Forms![pickupsheet]![cmbCarrier].Requery
    Forms![pickupsheet]![cmbCarrier].Value = txtCarrier
    End If
    If SysCmd(acSysCmdGetObjectState, acForm, "quote") = acObjStateOpen Then
    Forms![quote]![cmbCarrier].Requery
    Forms![quote]![cmbCarrier].Value = txtCarrier
    End If

    Then it would also check for both...

    I wasn't aware of your solution, and have already thought of a way to use
    that in my own app!
    Inspiration Through Fermentation

  10. #10
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    touché ^2

    congrats - you found an error in mine: if BOTH are open, mine only does the .requery on the "calling" form.

    great fun!

    izy
    currently using SS 2008R2

  11. #11
    Join Date
    Dec 2004
    Posts
    277
    thank you folks.. both of you have helped with this problem and one other I was having as well. Thank you very much..

Posting Permissions

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