Invisible forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • csolomon
    New Member
    • Mar 2008
    • 166

    Invisible forms

    Hello:

    I have a form (F_TestRpt) that needs to get it's information from an unbound value on another form (F_MixDesign). The issue is that the F_MixDesign form wouldn't be open when the F_TestRpt was open, so I was wondering if when the F_TestRpt was launched, if it would be possible to also launch the MixDesign form in the background as invisible?

    Thanks
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    You can use:
    Code:
    DoCmd.OpenForm "My Form Name", acNormal, , , , acHidden

    Comment

    • csolomon
      New Member
      • Mar 2008
      • 166

      #3
      Hi Chip,

      Should I use this in my onLoad or onCurrent Event?

      If I should use it in my onCurrent event, should it be in a Private Sub()? or can I just add it? I ask because I already have some requeries in the event:

      Private Sub Form_Current()
      Me.cbojobNumber .Requery
      Me.DM_Mix_cbo.R equery

      Me!SF_MixBatch. Form.DM_Materia lNo
      >>This part is not working though, I just wanted to Requery the control DM_MaterialNo on the SF_MixBatch Form when the main form is on the current record...I keep getting an error about it not being supported

      Me.List71.Reque ry

      End Sub

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        I'm a little confused. You said that the info you need on F_TestRpt is on F_MixDesign, which wouldn't normally be open. Where does F_MixDesign get the value for this control when you open it, and why can't you just do the same for a control on F_TestRpt?

        Your code seems unrelated, but if SF_MixBatch is a subform and you want to requery a control on it, use:
        Code:
        Me!SF_MixBatch.Form!DM_MaterialNo.Requery

        Comment

        • csolomon
          New Member
          • Mar 2008
          • 166

          #5
          the extra code was unrelated to opening the MixDesign form, but I need certain things to be updated in the event as well, which is why all of the other code is there. That's why I was asking if I should have that code in it's own event since all of the other code was in the event.

          F_MixDesign has the value for the control on it as a field...but what I just thought about is that when it's open it will always open to the first record so then that information will be xferred to the F_TestRpt, which would not be correct. But I guess since when my user opens the F_TestRpt form , he would navigate to what he was working on, which in turn would change the DM_Mix number, which in turn would update the F_MixDesign DM_Mix number??? Or would I have to add code to say as the DM_Mix on F_TestRpt changes, update to the correct DM_Mix in F_MixDesign?

          Comment

          • ChipR
            Recognized Expert Top Contributor
            • Jul 2008
            • 1289

            #6
            I'm not clear on how you want your users to navigate or use your forms, but you have some options. One thing you can do in the F_MixDesign in Current(), or some AfterUpdate() is check whether the other form is open, and if it is, update or requery whatevery you need to:
            Code:
            If CurrentProject.AllForms("Other Form Name").IsLoaded Then
                        'call requery on some control on that form
            End If

            Comment

            • csolomon
              New Member
              • Mar 2008
              • 166

              #7
              Chip,

              Here is what I have in my onCurrent event of the F_TestRpt:
              Private Sub Form_Current()
              Me.cbojobNumber .Requery
              Me.DM_Mix_cbo.R equery
              Me!SF_MixBatch. Form!DM_Materia lNo.Requery
              Me.List71.Reque ry


              'Open MixDesign in the background where DM_Mix = DM_Mix_cbo

              DoCmd.OpenForm "F_MixDesig n", View:=acNormal, _
              WhereCondition: ="DM_Mix = " & DM_Mix_cbo, _
              WindowMode:=acH idden
              End Sub

              And it works! As I change records in the form, the DM_Mix updates in the invisible form as well so I don't have to worry about it would get updated.

              Thanks for sharing your wisdom! :)

              Comment

              Working...