Link Two Forms Using Two Fields

  • Thread starter Thread starter Kirstie Adam
  • Start date Start date
K

Kirstie Adam

All,

I have a simple bit of code (created by using button wizard) that opens a
new form and finds a certain record. Linked by [Address Line 1].
However, i would like to also link it by [Company Name], as sometimes two
companies have the same [Address Line 1].
How would i do this?


-------------------------------------------

Private Sub Command88_Click()
On Error GoTo Err_Command88_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add New Address Frm"

stLinkCriteria = "[Address Line 1]=" & "'" & Me![Address] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command88_Click:
Exit Sub

Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click

End Sub
 
Hi Kirstie,

Please see my reply in microsoft.public.access.formscoding.

Rather than posting the same message to more than one group (multiposting)
please cross-post (send the one message to all groups at once). To
Crosspost, put all of the newsgroups into the Newsgroups field in the
message header. In this way, all responses to your post will be available
together, regardless of what group the responder was in, and the rest of us
won't have to read your post multiple times.

See http://www.mvps.org/access/netiquette.htm for more information.
 
I know, this is formscoding, - make that Microsoft.public.access.forms :-)

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Sandra said:
Hi Kirstie,

Please see my reply in microsoft.public.access.formscoding.

Rather than posting the same message to more than one group
(multiposting) please cross-post (send the one message to all groups
at once). To Crosspost, put all of the newsgroups into the Newsgroups
field in the message header. In this way, all responses to your post
will be available together, regardless of what group the responder
was in, and the rest of us won't have to read your post multiple
times.

See http://www.mvps.org/access/netiquette.htm for more information.


Kirstie said:
All,

I have a simple bit of code (created by using button wizard) that
opens a new form and finds a certain record. Linked by [Address Line
1]. However, i would like to also link it by [Company Name], as
sometimes two companies have the same [Address Line 1].
How would i do this?


-------------------------------------------

Private Sub Command88_Click()
On Error GoTo Err_Command88_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add New Address Frm"

stLinkCriteria = "[Address Line 1]=" & "'" & Me![Address] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command88_Click:
Exit Sub

Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click

End Sub
 
More coffee, Sandra? <g>

Fred

Sandra Daigle said:
I know, this is formscoding, - make that Microsoft.public.access.forms :-)

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Sandra said:
Hi Kirstie,

Please see my reply in microsoft.public.access.formscoding.

Rather than posting the same message to more than one group
(multiposting) please cross-post (send the one message to all groups
at once). To Crosspost, put all of the newsgroups into the Newsgroups
field in the message header. In this way, all responses to your post
will be available together, regardless of what group the responder
was in, and the rest of us won't have to read your post multiple
times.

See http://www.mvps.org/access/netiquette.htm for more information.


Kirstie said:
All,

I have a simple bit of code (created by using button wizard) that
opens a new form and finds a certain record. Linked by [Address Line
1]. However, i would like to also link it by [Company Name], as
sometimes two companies have the same [Address Line 1].
How would i do this?


-------------------------------------------

Private Sub Command88_Click()
On Error GoTo Err_Command88_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add New Address Frm"

stLinkCriteria = "[Address Line 1]=" & "'" & Me![Address] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command88_Click:
Exit Sub

Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click

End Sub
 
Hi Fred,

It has been a bad coffee day! First the new can of grounds exploded onto me
and the floor, then the first pot overflowed onto the counter and the floor.
I'm having a Diet Coke now ;-)
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Fred said:
More coffee, Sandra? <g>

Fred

Sandra Daigle said:
I know, this is formscoding, - make that
Microsoft.public.access.forms :-)

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Sandra said:
Hi Kirstie,

Please see my reply in microsoft.public.access.formscoding.

Rather than posting the same message to more than one group
(multiposting) please cross-post (send the one message to all groups
at once). To Crosspost, put all of the newsgroups into the
Newsgroups field in the message header. In this way, all responses
to your post will be available together, regardless of what group
the responder was in, and the rest of us won't have to read your
post multiple times.

See http://www.mvps.org/access/netiquette.htm for more information.


Kirstie Adam wrote:
All,

I have a simple bit of code (created by using button wizard) that
opens a new form and finds a certain record. Linked by [Address
Line 1]. However, i would like to also link it by [Company Name],
as sometimes two companies have the same [Address Line 1].
How would i do this?


-------------------------------------------

Private Sub Command88_Click()
On Error GoTo Err_Command88_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add New Address Frm"

stLinkCriteria = "[Address Line 1]=" & "'" & Me![Address] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command88_Click:
Exit Sub

Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click

End Sub
 
Back
Top