OpenForm to New Record and Add Values From Current Form

wezhogan

Registered User.
Local time
Today, 16:13
Joined
May 24, 2012
Messages
16
I've really been searching to figure out how to do this but keep getting lost. I know this can't be that hard and hope someone can either help me with the answer or point me to the right search key words so I can find the answer. Here is my problem:

I have a form (Form A) that the user enters demographic information about a client. Form A has a next button that will open Form B to a new record so the user can enter survey information for the client from Form A. I need Form B to create a new record when it is first open and need to pass the ClientIDNumber, the ClientFirstName, and the ClientLastName to Form B from Form A.

I hope someone can help me, I'm sorry if I am duplicating a question that has been asked a bunch of times. I'm pretty new to the forum and haven't worked in Access for years. By the way I am using Access 2010, don't know if that makes any difference. I have some basic VBA programming skills but again haven't used them in quite a few years so am a little rusty.

Thanks
 
Look in help at OpenForm, paying particular attention to the data mode argument. Then

Destination = Source

as in:

Code:
Forms!SecondFormName.TextboxName = Forms!FirstFormName.TextboxName
 
Oh, and if the second form will only be used to add new records, you can set its Data Entry property appropriately and not worry about the data mode argument. I typically use the same form for entry and edit though.
 
That did it. I appreciate the help, especially so quickly. This is what I did for anyone searching for this answer:

Private Sub bnNext_Click()
DoCmd.OpenForm "frmPrescreening", acNormal, , , acFormAdd, acWindowNormal
[Forms]![frmPreScreening]![IDNumber] = [Forms]![frmViewContact]![IDNumber]
[Forms]![frmPreScreening]![FirstName] = [Forms]![frmViewContact]![FirstName]
[Forms]![frmPreScreening]![LastName] = [Forms]![frmViewContact]![LastName]

End Sub
 

Users who are viewing this thread

Back
Top Bottom