cascading combo boxes

  • Thread starter Frustrated in Formland
  • Start date
F

Frustrated in Formland

I searched through this group and couldn't find the answer to this
question/scenario...

I have 4 cascading combo boxes that work perfectly only if the user starts
from Box 1 and goes to Box 4 or starts from Box 2 and goes to Box 4, i.e.,
ascending order. However, is it possible for a user to go in reverse? In
other words, if the user selects a value in Box 4, it will filter the values
in Box 3 and so on.

I have played around with my code but can't figure it out...if this is
possible and I need to supply some code, please let me know. I didn't want
to supply it, if this function can not be performed. Or if anyone has an
example, that would also be greatly appreciated.
 
D

Douglas J Steele

It's possible, but it's hard for me to imagine what you're trying to do.

The approach will vary on how you're accomplishing the cascade from 1 to 4
as well.
 
V

Vantastic

Hi there

I just nutted one of these situations out today. Hope this is of some help
to you. This is the code I used on my On Current:

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

Dim stCertificate, stClass, stSubclass

lstSubclass.Value = Certificate.Value

stSubclass = Certificate.Value
' This below works to find Class from SubClass

stClass = DLookup("[ClassID]", "Classes", "[ClassID]=" &
DLookup("[SubCLassParent]", "SubClass", "[SubclassID]= lstsubclass.Value"))
lstClass.Value = stClass

stCertificate = DLookup("[CertificateID]", "Certificates",
"[CertificateID]=" & DLookup("[CLassParent]", "Classes", "[ClassID]=
lstclass.Value"))
lstCertificate = stCertificate

lstClass.Requery
lstClass.Value = stClass

lstSubclass.Requery
lstSubclass.Value = stSubclass


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

Basically I have a Subclass.value available on the form. The heirarchy of my
3 tables are as such

1 -Certificate
2 ---Class
3 -----SubClass

The code finds out, using the DLookup function, Subclass, then class, then
finally certificate. Whereas my users have used the code in the opposite
direction to input the data, i'm using this code to show the users what it is
that their selection corresponds to.

Dlookup can get pretty crazy, especially if you're embedding it inside
another dlookup... Good luck!
 
Top