Conect a table with 2 columns from another table

  • Thread starter Thread starter Rictus
  • Start date Start date
R

Rictus

Hi all,

I am somewhat new in this so any help will be highly appreciated:

Problem:
I have a large number of objects that may be of type: A, B or C and subtypes
a1, a2, a3, b1, b2 where a1,a2,a3 can be associated only to object of type A
and so on...

If I have a table with this 2 columns
A a1
A a2
A a3
B b1
B b2
C
and another table where I want to have 3 columns:
Object1 A a2
Object2 B b1
....
ObjectX A a3
what kind of linkage should I do in order to able to select subtypes a1, a2,
a3 only for objects that have type A and so on...

Since my English is not so great I hope I was able to explain the problem in
the right way.

And like I already mentioned: any help will be highly appreciated. :-)

Thanks guys!
 
Hi Rictus,

Try this:

Using form named "Form6" with combo boxes named "cbTypeCode" and
"cbSubTypeCode". Row source of cbTypeCode is:

SELECT [tblTypeCodes].[TypeCode] FROM [tblTypeCodes] ORDER BY [TypeCode]

It has an on change ever that does:

cbTypeSubCode.Requery

Row source for cbSubTypeCode is:

SELECT tblTypeSubCodes.TypeSubCode FROM tblTypeSubCodes WHERE
(((tblTypeSubCodes.TypeCode)=[Forms]![Form6]![cbTypeCode])) ORDER BY
tblTypeSubCodes.TypeSubCode;

You may also need to clear cbSubTypeCode's value in the on change event
so that when someone selects A and a1 and then changes the type to B the
subtype does not remain at a1:

cbTypeSubCode.Value = Null

If nulls are not allowed, you may need to set it to the first value in
the list:

cbTypeSubCode.Value = cbTypeSubCode.Column(0, 0)

Hope this helps,

Clifford Bass
 
Back
Top