Filtering Form for a Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Davis
    New Member
    • Mar 2008
    • 41

    Filtering Form for a Report

    Hello,

    Ran into a snag while building my database. I have several forms but lets work with two for right now; Form1 and Form2 both have the same fields but use by two different users but both are connected to Report1. How can I get only the data in Form1 to show and vice versa for Form2. Is this possible?

    David
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by David Davis
    Hello,

    Ran into a snag while building my database. I have several forms but lets work with two for right now; Form1 and Form2 both have the same fields but use by two different users but both are connected to Report1. How can I get only the data in Form1 to show and vice versa for Form2. Is this possible?

    David
    You can actually assign the Recordset of one Form to another, this is probably the easiest Method:
    [CODE=vb]
    Set Forms!Form2.Rec ordset = Forms!Form1.Rec ordset
    OR
    Set Forms!Form1.Rec ordset = Forms!Form2.Rec ordset[/CODE]

    Comment

    • David Davis
      New Member
      • Mar 2008
      • 41

      #3
      Originally posted by ADezii
      You can actually assign the Recordset of one Form to another, this is probably the easiest Method:
      [CODE=vb]
      Set Forms!Form2.Rec ordset = Forms!Form1.Rec ordset
      OR
      Set Forms!Form1.Rec ordset = Forms!Form2.Rec ordset[/CODE]
      You have to forgive me ADezii on my knowledge but where do I put this formula at exactly.

      David

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by David Davis
        You have to forgive me ADezii on my knowledge but where do I put this formula at exactly.

        David
        If you are opening FormB from FormA, then you can place the following code
        in the Open() Event of FormB:
        [CODE=vb]
        Set Forms!FormB.Rec ordset = Forms!FormA.Rec ordset[/CODE]

        Comment

        • David Davis
          New Member
          • Mar 2008
          • 41

          #5
          Dzii,

          I see the formula and I havent tried it as of yet but I think I need to give clarity. When you open the form (without your coding) it gives me every record that any person has inputted from their individual form. All forms have the same data fields which are connected to one report the feeds off a master table. So when I am in form1 (for example) I get the everybodys record when I go to report (I push a command button that takes me to my report so I can print my records there) and I only want the records of the users form. Now after reading all this would that be the right coding I need. I really need your help on this one.

          David

          Comment

          • David Davis
            New Member
            • Mar 2008
            • 41

            #6
            ADezii,

            Have you came up with anything yet on the last reply.

            David
            Last edited by David Davis; Mar 21 '08, 02:26 PM. Reason: Correct name

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by David Davis
              Dzii,

              I see the formula and I havent tried it as of yet but I think I need to give clarity. When you open the form (without your coding) it gives me every record that any person has inputted from their individual form. All forms have the same data fields which are connected to one report the feeds off a master table. So when I am in form1 (for example) I get the everybodys record when I go to report (I push a command button that takes me to my report so I can print my records there) and I only want the records of the users form. Now after reading all this would that be the right coding I need. I really need your help on this one.

              David
              I only want the records of the users form
              I am not exactly sure what you mean by this, please explain in greater detail.

              Comment

              • David Davis
                New Member
                • Mar 2008
                • 41

                #8
                Originally posted by ADezii
                I am not exactly sure what you mean by this, please explain in greater detail.
                ADezii,

                I apologize for the confusion and hope this clarifies the previous a bit more.

                The user uses form1to input information into Masterdatabase( table). Form1 has a cmd button that when pushed it opens Report1. When Report1 opens it brings up every record in Masterdatabase. I only want the records that the user inputed into form1 to come up on Report1 when the cmd button is pushed.

                David

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #9
                  Originally posted by David Davis
                  ADezii,

                  I apologize for the confusion and hope this clarifies the previous a bit more.

                  The user uses form1to input information into Masterdatabase( table). Form1 has a cmd button that when pushed it opens Report1. When Report1 opens it brings up every record in Masterdatabase. I only want the records that the user inputed into form1 to come up on Report1 when the cmd button is pushed.

                  David
                  1. Is there any indicator that will pinpoint exactly what Records a specific User added?
                  2. Is there a Primary Key Field in the MasterDatabase Table?
                  3. If there is a PK Field in the MasterDatabase Table, what is its Data Type?
                  4. If there is no Primary Key Field in MasterTable, is there an AutoNumber Field or a sequentially numbered Field?

                  Comment

                  • David Davis
                    New Member
                    • Mar 2008
                    • 41

                    #10
                    Originally posted by ADezii
                    1. Is there any indicator that will pinpoint exactly what Records a specific User added?
                    2. Is there a Primary Key Field in the MasterDatabase Table?
                    3. If there is a PK Field in the MasterDatabase Table, what is its Data Type?
                    4. If there is no Primary Key Field in MasterTable, is there an AutoNumber Field or a sequentially numbered Field?
                    ADezii,

                    - There is a Primary Key Field (Sequential Serial Number (Data Type Number) in the MasterDatabase Table. The information that identifies each user is their name (Data Type Text) entered in each record.
                    Last edited by David Davis; Mar 23 '08, 02:32 AM. Reason: Added missed information

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #11
                      Originally posted by David Davis
                      ADezii,

                      - There is a Primary Key Field (Sequential Serial Number (Data Type Number) in the MasterDatabase Table. The information that identifies each user is their name (Data Type Text) entered in each record.
                      Just resubscribing, will return later.

                      Comment

                      • ADezii
                        Recognized Expert Expert
                        • Apr 2006
                        • 8834

                        #12
                        Originally posted by David Davis
                        ADezii,

                        - There is a Primary Key Field (Sequential Serial Number (Data Type Number) in the MasterDatabase Table. The information that identifies each user is their name (Data Type Text) entered in each record.
                        This is basically a 2-step process:
                        1. When the Form is initially opened, obtain the value of the Last Primary Key Entry, let's just assume it is 876.
                        2. Open Report1 with the Criteria of > 876 on the Primary Key Field.
                        3. Only the Records that the Current User entered will be reflected in Report1.
                        4. For an additional User, you would have to Close then Re-open the Form to repeat the process.
                        5. Is this what you are looking for, and do you need additional help on how to implement this?

                        Comment

                        • David Davis
                          New Member
                          • Mar 2008
                          • 41

                          #13
                          Originally posted by ADezii
                          This is basically a 2-step process:
                          1. When the Form is initially opened, obtain the value of the Last Primary Key Entry, let's just assume it is 876.
                          2. Open Report1 with the Criteria of > 876 on the Primary Key Field.
                          3. Only the Records that the Current User entered will be reflected in Report1.
                          4. For an additional User, you would have to Close then Re-open the Form to repeat the process.
                          5. Is this what you are looking for, and do you need additional help on how to implement this?
                          Thanks ADezii,

                          I do need help on implementing this. I am however confused on just the Criteria of > 876 without having anything unique to the Current User. Wouldnt that just bring up every record from the MasterDataBase Table (from > 876) no matter who the user is?

                          David

                          Comment

                          • ADezii
                            Recognized Expert Expert
                            • Apr 2006
                            • 8834

                            #14
                            Originally posted by David Davis
                            Thanks ADezii,

                            I do need help on implementing this. I am however confused on just the Criteria of > 876 without having anything unique to the Current User. Wouldnt that just bring up every record from the MasterDataBase Table (from > 876) no matter who the user is?

                            David
                            Assuming the Record Source for Report1 is the same or at least contains the [Name] Fields that exist in the Form, you could restrict Report1's Records to only those for the Current User by something similar to the following (assuming you have [LastName] and [FirstName] Fields, and your Text Box Names are txtLastName and txtFirstName):
                            [CODE=vb]
                            DoCmd.OpenRepor t "Report1", acViewPreview, , "[LastName] = '" & Me![txtLastName] & "'" & _
                            " And [FirstName] = '" & Me![txtFirstName] & "'"[/CODE]
                            NOTE: This would return 'ALL" Records from the MasterDataBase by the Current User, not the most newly entered ones. This is where the idea of capturing the Last Primary Key Value comes in, but if the above is what you want, that is fine.

                            Comment

                            • David Davis
                              New Member
                              • Mar 2008
                              • 41

                              #15
                              Originally posted by ADezii
                              Assuming the Record Source for Report1 is the same or at least contains the [Name] Fields that exist in the Form, you could restrict Report1's Records to only those for the Current User by something similar to the following (assuming you have [LastName] and [FirstName] Fields, and your Text Box Names are txtLastName and txtFirstName):
                              [CODE=vb]
                              DoCmd.OpenRepor t "Report1", acViewPreview, , "[LastName] = '" & Me![txtLastName] & "'" & _
                              " And [FirstName] = '" & Me![txtFirstName] & "'"[/CODE]
                              NOTE: This would return 'ALL" Records from the MasterDataBase by the Current User, not the most newly entered ones. This is where the idea of capturing the Last Primary Key Value comes in, but if the above is what you want, that is fine.
                              ADezii,
                              The coding that you mention is want I want but I also want current input.
                              What is the process on capturing th Last Primary Key Value for current input for the current date?

                              David

                              Comment

                              Working...