Same text fields in two different forms

J

jnbryant

How do I open a second form from the first form and having the similar fields
populated with the same information? Below is an example of how I am getting
the second form to open. I want the last name, first name, address and phone
number to be transferred over to the second form.
_______________________

Private Sub OpenFUForm_Click()
On Error GoTo Err_OpenFUForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fmFUNBCB"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec

Exit_OpenFUForm_Click:
Exit Sub

Err_OpenFUForm_Click:
MsgBox Err.Description
Resume Exit_OpenFUForm_Click

End Sub
____________________________

Thanks for any help.
 
S

Scott Whetsell, A.S. - WVSP

One option is to add a line for each field you want to fill, such as:

DoCmd.OpenForm "fmFUNBCB", , , ,acAddNew
Forms![fmFUNBCB]![LastName] = Me.LastName
Forms![fmFUNBCB]![Firstname] = Me.FirstName

and so on for each field.
 
J

jnbryant

Scott,
Thank you so much. It worked. I have been working on it for hours and
seems so simple. Access/VBA has been a self learning process.

Jill



Scott Whetsell said:
One option is to add a line for each field you want to fill, such as:

DoCmd.OpenForm "fmFUNBCB", , , ,acAddNew
Forms![fmFUNBCB]![LastName] = Me.LastName
Forms![fmFUNBCB]![Firstname] = Me.FirstName

and so on for each field.



jnbryant said:
How do I open a second form from the first form and having the similar fields
populated with the same information? Below is an example of how I am getting
the second form to open. I want the last name, first name, address and phone
number to be transferred over to the second form.
_______________________

Private Sub OpenFUForm_Click()
On Error GoTo Err_OpenFUForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fmFUNBCB"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec

Exit_OpenFUForm_Click:
Exit Sub

Err_OpenFUForm_Click:
MsgBox Err.Description
Resume Exit_OpenFUForm_Click

End Sub
____________________________

Thanks for any help.
 
S

Scott Whetsell, A.S. - WVSP

Any time. I'm still teaching myself, and these forumns are an excellent
resource. Best of luck with your project.

jnbryant said:
Scott,
Thank you so much. It worked. I have been working on it for hours and
seems so simple. Access/VBA has been a self learning process.

Jill



Scott Whetsell said:
One option is to add a line for each field you want to fill, such as:

DoCmd.OpenForm "fmFUNBCB", , , ,acAddNew
Forms![fmFUNBCB]![LastName] = Me.LastName
Forms![fmFUNBCB]![Firstname] = Me.FirstName

and so on for each field.



jnbryant said:
How do I open a second form from the first form and having the similar fields
populated with the same information? Below is an example of how I am getting
the second form to open. I want the last name, first name, address and phone
number to be transferred over to the second form.
_______________________

Private Sub OpenFUForm_Click()
On Error GoTo Err_OpenFUForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fmFUNBCB"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec

Exit_OpenFUForm_Click:
Exit Sub

Err_OpenFUForm_Click:
MsgBox Err.Description
Resume Exit_OpenFUForm_Click

End Sub
____________________________

Thanks for any help.
 
J

John W. Vinson

How do I open a second form from the first form and having the similar fields
populated with the same information? Below is an example of how I am getting
the second form to open. I want the last name, first name, address and phone
number to be transferred over to the second form.
_______________________

Private Sub OpenFUForm_Click()
On Error GoTo Err_OpenFUForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fmFUNBCB"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec

Exit_OpenFUForm_Click:
Exit Sub

Err_OpenFUForm_Click:
MsgBox Err.Description
Resume Exit_OpenFUForm_Click

End Sub

Just a warning: data is NOT stored in forms. It's stored in Tables. If you're
trying to store the name, address and phone redundantly in two different
tables - or, with a VERY few exceptions, in two different records in the same
table - you're making a big mistake.

Relational databases use the "Grandmother's Pantry Principle" - "a place - ONE
place! - for everything, everything in its place". You should have a table of
People (or Contacts, or whatever you want to call it) with the person's name
and contact information, stored *once and once only*, with a meaningless
numeric primary key identifier; if you need that information in conjunction
with some other table, you would store the PersonID and link to it with a
query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top