link master/child subform using "like"

D

Don

Is there any way to have a subform link to the master form by using a "like"
or "begins with" function? For example, my master and child control is
[strReviewID]. The value for my master [strReviewID] is "1234567", and I want
to link to the child [strReviewID] control with any values that begin with or
is like the first 7 characters, e.g. "1234567A", "1234567B", "1234567C",
etc.
 
D

Douglas J. Steele

I believe the only way would be to put a computed field Left([strReviewID],
7) in the query that makes up the RecordSource of the subform and link to
it.
 
J

John W. Vinson

Is there any way to have a subform link to the master form by using a "like"
or "begins with" function? For example, my master and child control is
[strReviewID]. The value for my master [strReviewID] is "1234567", and I want
to link to the child [strReviewID] control with any values that begin with or
is like the first 7 characters, e.g. "1234567A", "1234567B", "1234567C",
etc.

You're paying the penalty for violating the basic principle that fields should
be atomic. That is, your table structure is *wrong*. I'd very strongly
suggest modifying the structure of the child table so that the ReviewID is
just the numeric portion, and add a *separate field* ReviewIdLetter to hold
the A, B, C and so on. You can make these two fields a joint two-field primary
key if you wish, and of course you can concatenate them in a calculated field
for display purposes.

John W. Vinson [MVP]
 

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