Check Boxes to Pass into Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32664

    #61
    You could have (in the MakeFilter routine) :
    Code:
    Me![Practice].Form.Filter = strFilter
    Me![Practice1].Form.Filter = strFilter
    But the Export would not easily be done with OutputTo.
    There may be another way it could be done which provided a Filter or WhereClause parameter but not that way :(

    Comment

    • ChaseCox
      Contributor
      • Nov 2006
      • 293

      #62
      Originally posted by NeoPa
      Your code actually answered my main question Chase.
      Pages (where you have multiple tabs) are not treated as part of the reference structure.
      So, if I want to reference the SubForm from outside of it, I don't need to include a part for the page. That is determined automatically by the interpreter knowing which items are on each page.
      That solution may not be elegant, but if it works that should be fine.
      What I was thinking of (and I'll go into more detail if (only if) you express an interest) was to leave the record source as it is (without any connection to the form) and simply apply a Filter to the form in the SubForm when required.
      This way we avoid messy references to Form.Control's current values within the SQL.
      If you've got what you want and are happy with it though, that's cool.

      I would be interested to see how that works, if you do not mind.

      Comment

      • ChaseCox
        Contributor
        • Nov 2006
        • 293

        #63
        Just a thought, as you were looking through my database and code I have been posting. The material query takes around 8-10 minutes to run. Do you know any way to stream line this process, or am I going to just have to wait?

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32664

          #64
          Originally posted by ChaseCox
          I would be interested to see how that works, if you do not mind.
          I'll have a look at posting something this evening when i have more time available.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32664

            #65
            Originally posted by ChaseCox
            Just a thought, as you were looking through my database and code I have been posting. The material query takes around 8-10 minutes to run. Do you know any way to stream line this process, or am I going to just have to wait?
            As this is in a public forum, could you post the question as if I didn't have your database. Then other readers can follow better what's going on, and I can look at it this evening with the other stuff.

            Comment

            • ChaseCox
              Contributor
              • Nov 2006
              • 293

              #66
              I will just paste into a new topic.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32664

                #67
                Good idea - but include a link to this one so that the database can be downloaded by anyone easily.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32664

                  #68
                  Originally posted by ChaseCox
                  I would be interested to see how that works, if you do not mind.
                  Code:
                  Private Sub MakeFilter()
                      Dim strFilter As String
                  
                      strFilter = ""
                      If Nz(chkvoy2, False) Then _
                          strFilter = strFilter & ",'0463','0465','0467'"
                      If Nz(chkvoy3, False) Then _
                          strFilter = strFilter & ",'0382'"
                      If Nz(chkipk, False) Then _
                          strFilter = strFilter & ",'0383','0393','0422'"
                      If Nz(chkody, False) Then _
                          strFilter = strFilter & ",'0419','0411','0416','0418'"
                      If Nz(chkpre, False) Then _
                          strFilter = strFilter & ",'0281','0282','0279','0280'" & _
                                                  ",'0284','0287','0513','0514'" & _
                                                  ",'0515','0516','0517','0518'"
                      If Nz(chkwsp, False) Then _
                          strFilter = strFilter & ",'0328','0331','0176','0075'" & _
                                                  ",'0326','0332','0042','0142'"
                      If Nz(chkchil, False) Then _
                          strFilter = strFilter & ",'0361','0362','0385','0386'"
                  
                      If strFilter > "" Then _
                          strFilter = "([PROD_CODE] In(" & Mid(strFilter, 2) & "))"
                      Me![Practice].Form.Filter = strFilter
                      Me![Practice1].Form.Filter = strFilter
                      'Me.Filter = strFilter
                      'Call Me.Requery
                      [txtsee] = strFilter
                  End Sub
                  
                  Private Sub Command78_Click()
                  On Error GoTo Err_Command78_Click
                  
                      Me![Practice].Form.RecordSource = "Material Query"
                      Me![Practice].Form.Requery
                      
                  Exit_Command78_Click:
                      Exit Sub
                      
                  Err_Command78_Click:
                      MsgBox Err.Description
                      Resume Exit_Command78_Click
                      
                  End Sub
                  
                  Private Sub Lbrbutton_Click()
                  On Error GoTo Err_Lbrbutton_Click
                  
                      Me![Practice1].Form.RecordSource = "Labor Query"
                      Me![Practice1].Form.Requery
                  
                  Exit_Lbrbutton_Click:
                      Exit Sub
                  
                  Err_Lbrbutton_Click:
                      MsgBox Err.Description
                      Resume Exit_Lbrbutton_Click
                      
                  End Sub

                  Comment

                  • ChaseCox
                    Contributor
                    • Nov 2006
                    • 293

                    #69
                    That did not get it. I suppose I am happy for now with my solution. Thank you for all of your help, you were a tremendous help to me.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32664

                      #70
                      I'm pleased I was able to help :)

                      Comment

                      • RookieDan
                        New Member
                        • Nov 2006
                        • 8

                        #71
                        Neat solution NeoPa.. Im gonna use this..

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32664

                          #72
                          Originally posted by RookieDan
                          Neat solution NeoPa. Im gonna use this.
                          Thank you - pleased to be able to help.
                          Another thread that may be of some help is (Example Filtering on a Form).

                          Comment

                          Working...