Use stLinkCriteria for 3 fields

G

Guest

I have a table that has 3 fields as its primary key. How do I create a
stLinkCriteria phrase that will open another form using those three fields as
the linking criteria?

Field names are FName, LName & Phone1
 
A

Allen Browne

Assuming these are all Text fields (not Number fields), you need something
like this:

stLinkCriteria = "(FName = """ & Me.FName & _
""") AND (LName = """ & Me.LName & _
""") AND (Phone1 = """ & Me.Phone1 & """)"
 
G

Guest

Thanks, Allen! Along similar lines, I have a combo box for doing "searches"
on a form. Again, the Primary Key is composed of these same 3 fields. But I
can only get it to bind to 1 column; I need it to bind to all 3 columns.
Right now, if I search for "Smith" & there are 3 "Smiths", it will only go to
the 1st "Smith", even though I am selecting the 2nd or 3rd one. I assume
that's because it can only be bound to column 1. Can I bind it to 3 columns?
 
J

John Vinson

Thanks, Allen! Along similar lines, I have a combo box for doing "searches"
on a form. Again, the Primary Key is composed of these same 3 fields. But I
can only get it to bind to 1 column; I need it to bind to all 3 columns.
Right now, if I search for "Smith" & there are 3 "Smiths", it will only go to
the 1st "Smith", even though I am selecting the 2nd or 3rd one. I assume
that's because it can only be bound to column 1. Can I bind it to 3 columns?

You'll do much better to have a unique PersonID (which might not be
meaningful or visible to the user), and use it as the bound column of
the combo.

John W. Vinson[MVP]
 
A

Allen Browne

Donna, I agree with John that adding an AutoNumber to your table will be
easier than trying to handle the 3-field combo.

It will also simplify your life when you come to create related tables for
these entries.
 

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