Need 2 links...

G

Guest

Hi everyone! Using A02 on XP. I have a link that (with help) works great.
Now I need to link to 2 fields. I have 2 fields [TPAID] and [TPAContactID].
Each record has both completed. TPA ID is for the TPA Company info and TPA
Contact ID is for info on an employee of the TPA Company that is assigned to
that case. One TPA Company might have 6 different employees working our
cases. So [TPAID]=62 might have [TPAContactID]=16, 26 and 53 (for John, Jane
and Joan).

How do I add a second 'link'? Here is what I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"
stLinkCriteria = "[TPAID]=" & Me![TPAID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Would love it if someone could help on this. BTW - both fields are numbers
rather than text.

Thanks in advance for any help or advice!!!
 
G

Guest

Hi Bonnie,

Well the short answer is

'---snip---
stDocName = "TPA-Address-Form"
stLinkCriteria = "[TPAID]=" & Me![TPAID]
stLinkCriteria = stLinkCriteria & "And [TPAContactID]= " & Me![TPAContactID]

DoCmd.OpenForm stDocName, , , stLinkCriteria
'---snip---

** Change Me![TPAContactID] to the name of the control on your form.

The code above assumes that you are looking for only one person at a time ,
ie Jane but not John or Joan. And that both combo boxes will never be Null.


If you want to select two or more people, then you will need to change the
combo box "TPAContactID" to a multi-select list box and add code to create
stLinkCriteria.

HTH
 
G

Guest

Hi Steve! Sorry to take so long to check this thread but forgot to click the
Notify Me of Replies. Works GREAT, thanks for the help!!!
--
Bonnie W. Anderson
Cincinnati, OH


SteveS said:
Hi Bonnie,

Well the short answer is

'---snip---
stDocName = "TPA-Address-Form"
stLinkCriteria = "[TPAID]=" & Me![TPAID]
stLinkCriteria = stLinkCriteria & "And [TPAContactID]= " & Me![TPAContactID]

DoCmd.OpenForm stDocName, , , stLinkCriteria
'---snip---

** Change Me![TPAContactID] to the name of the control on your form.

The code above assumes that you are looking for only one person at a time ,
ie Jane but not John or Joan. And that both combo boxes will never be Null.


If you want to select two or more people, then you will need to change the
combo box "TPAContactID" to a multi-select list box and add code to create
stLinkCriteria.

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Bonnie A said:
Hi everyone! Using A02 on XP. I have a link that (with help) works great.
Now I need to link to 2 fields. I have 2 fields [TPAID] and [TPAContactID].
Each record has both completed. TPA ID is for the TPA Company info and TPA
Contact ID is for info on an employee of the TPA Company that is assigned to
that case. One TPA Company might have 6 different employees working our
cases. So [TPAID]=62 might have [TPAContactID]=16, 26 and 53 (for John, Jane
and Joan).

How do I add a second 'link'? Here is what I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "TPA-Address-Form"
stLinkCriteria = "[TPAID]=" & Me![TPAID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Would love it if someone could help on this. BTW - both fields are numbers
rather than text.

Thanks in advance for any help or advice!!!
 

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