INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Adding record in Access form with filtered data

Adding record in Access form with filtered data

(OP)
I have an Access form that I am having trouble assigning a specific value to a field in that form.  I have mostly used the wizards to create a lot of my forms, so I only have minimal experience with VBA coding.  I will try to give the clearest picture on what I'm trying to do.  

From "Form1" I added a button to open "Form2". By using the wizards to create the "Form2", when "Form2" opens, it has filtered the records based on the field "MemberID".  "Form1" is based on a "Table1" that has the field "MemberID" in it and "Form2" is based on "Table2" and it also has a field "MemberID" in it, so it can be used to link the two tables.

Once "Form2" opens from "Form1", it displays the filtered records as it should.  I want to add records to "Form2".  I created a button from the wizards to add a new record, but I want the button to also fill in the "MemberID" on "Form2" that is the same as the "MemberID" that was used to filter the data from "Form1".  Here is the only code that is on the Button on "Form2".   What code do I need to add so that the "MemberID" from "Form1" is placed in the "MemberID" field in the new record on "Form2"?


Private Sub AddBut_Click()
On Error GoTo Err_AddBut_Click

               DoCmd.GoToRecord , , acNewRec
                
             
Exit_AddBut_Click:
        Exit Sub

Err_AddBut_Click:
        MsgBox Err.Description
        Resume Exit_AddBut_Click
    
End Sub
 

RE: Adding record in Access form with filtered data

(OP)
Ok, Sorry

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close