Check Boxes to Pass into Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChaseCox
    Contributor
    • Nov 2006
    • 293

    #46
    Originally posted by NeoPa
    I'll PM you an address to send it to.
    I was hoping you'd come back and say something like - "Oh sorry - I forgot the Compact & Repair bit."
    oh sorry I forgot the Compact and Repair bit! lol file is still too large to upload 51.7 KB

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32645

      #47
      ROFLMAO.
      You didn't forget to delete all the data first by any chance did you? That could make it work. You'd have to Compact & Repair after that again though, and Zip it up again.

      Comment

      • ChaseCox
        Contributor
        • Nov 2006
        • 293

        #48
        Originally posted by NeoPa
        ROFLMAO.
        You didn't forget to delete all the data first by any chance did you? That could make it work. You'd have to Compact & Repair after that again though, and Zip it up again.
        Yeah all the data is gone, just the "shell" i suppose. I sent it to you though.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32645

          #49
          Originally posted by ChaseCox
          Yeah all the data is gone, just the "shell" i suppose. I sent it to you though.
          Yes - the 'Shell'.
          But in there is pretty well all the important logic etc.
          This should help greatly.
          L8rs -Adrian.

          Comment

          • ChaseCox
            Contributor
            • Nov 2006
            • 293

            #50
            Originally posted by NeoPa
            Yes - the 'Shell'.
            But in there is pretty well all the important logic etc.
            This should help greatly.
            L8rs -Adrian.
            I will be here at my Comp for about an hour and 1/2, then I have to go on a trip. I may have access to access (ha) during the weekend, but I am not sure. I will be back in the office Tuesday Morning US Central Time 13:36 here now. Thanks again.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32645

              #51
              In truth, I doubt I'll be able to do much in that time although it's not impossible.
              I'll try to leave you something for your return at least though.

              Comment

              • ChaseCox
                Contributor
                • Nov 2006
                • 293

                #52
                Originally posted by NeoPa
                In truth, I doubt I'll be able to do much in that time although it's not impossible.
                I'll try to leave you something for your return at least though.
                Ok thank you very much. Have a good weekend. Quit question, Are you working this late, or are you on your own time helping me? Either way I am Tremendously appreciative.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32645

                  #53
                  Not working really.
                  Just doing TSDN work from my work PC.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32645

                    #54
                    Right, I'll try to post in here all the issues I come across while looking at your database so that you get the feedback, but also anyone reading the thread will be able to follow what's happened.
                    Firstly I notice that this is an Access 97 database.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32645

                      #55
                      The page you use with all the CheckBoxes on is essentially a sibling of the two pages (subforms) you want to populate when you click the command buttons.
                      This means that the strFilter will need to be available globally (available to all procedures for the whole form) I'll have to look into what is available where between different form objects within subform objects of a main form.
                      I'll repost when I've made some progress.

                      Comment

                      • ChaseCox
                        Contributor
                        • Nov 2006
                        • 293

                        #56
                        Originally posted by NeoPa
                        The page you use with all the CheckBoxes on is essentially a sibling of the two pages (subforms) you want to populate when you click the command buttons.
                        This means that the strFilter will need to be available globally (available to all procedures for the whole form) I'll have to look into what is available where between different form objects within subform objects of a main form.
                        I'll repost when I've made some progress.

                        Ok thanks.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32645

                          #57
                          Originally posted by ChaseCox
                          Ok thanks.
                          You weren't due back till Tuesday! Surprise.
                          I think I need another review on this. Let me know what's still outstanding when you check out all that's there since you left (I hope there's some actual info there and not just rambles about versions etc). At least I should understand better where you're coming from.
                          I think accessing Pages on the main form is transparent. I mean referring to a control on one page from another should still be Me.ControlName. Can you check this is right when you get a minute. I can't really run the database as there's no data (and finding time will be difficult too).

                          Comment

                          • ChaseCox
                            Contributor
                            • Nov 2006
                            • 293

                            #58
                            I am not sure If I understood what you were asking for in the last post. I am still stuck where I was on Friday.

                            Comment

                            • ChaseCox
                              Contributor
                              • Nov 2006
                              • 293

                              #59
                              HOORAY. After spending all day I got it to work. Here is what I did.

                              Code:
                              Private Sub chkvoy2_AfterUpdate()
                              
                               Call MakeFilter
                              
                              End Sub
                              
                              Private Sub chkvoy3_AfterUpdate()
                               
                               Call MakeFilter
                               
                              End Sub
                              
                              Private Sub chkchil_AfterUpdate()
                              
                               Call MakeFilter
                               
                              End Sub
                              
                              Private Sub chkipk_AfterUpdate()
                              
                              Call MakeFilter
                              
                              End Sub
                              
                              Private Sub chkody_AfterUpdate()
                              
                              Call MakeFilter
                              
                              End Sub
                              
                              Private Sub chkpre_AfterUpdate()
                              
                              Call MakeFilter
                              
                              End Sub
                              
                              Private Sub chkwsp_AfterUpdate()
                              
                               Call MakeFilter
                               
                              End Sub
                              Private Sub MakeFilter()
                                 
                              
                                  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'"
                              
                              
                                  [txtsee] = strFilter
                              End Sub
                              
                              Private Sub Command78_Click()
                              On Error GoTo Err_Command78_Click
                              
                              txtsee.SetFocus
                              
                              If Nz(chkmat, False) Then _
                              
                                  DoCmd.OutputTo acOutputQuery, "Material Query", acFormatXLS, "", False
                              
                              End If
                              
                              Forms![Form1]![Practice].Form.RecordSource = "Material Query"
                                  
                              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
                                 
                              txtsee.SetFocus
                              
                              If Nz(chklab, False) Then _
                              
                                   DoCmd.OutputTo acOutputQuery, "Labor Query", acFormatXLS, "", False
                              
                              End If
                              
                              Forms![Form1]![Practice1].Form.RecordSource = "Labor Query"
                              
                              Exit_Lbrbutton_Click:
                                  Exit Sub
                              
                              Err_Lbrbutton_Click:
                                  MsgBox Err.Description
                                  Resume Exit_Lbrbutton_Click
                              
                              End Sub
                              I am passing the product codes into a text box that is then referenced by a query string:

                              Code:
                              InStr([Forms]![Form1]![txtsee].[Text],[Prod_Code])
                              may not be elegant, but it works!

                              Comment

                              • NeoPa
                                Recognized Expert Moderator MVP
                                • Oct 2006
                                • 32645

                                #60
                                Originally posted by ChaseCox
                                I am not sure If I understood what you were asking for in the last post. I am still stuck where I was on Friday.
                                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.

                                Comment

                                Working...