VBA code doesn't seem to work for cascading combo box

shapman

Registered User.
Local time
Today, 15:00
Joined
Aug 30, 2007
Messages
55
Hi

I have tried the following code for a cascading combo box:

Private Sub cboStatustype_AfterUpdate()

On Error GoTo MyErrorHandler

cboSubstatus.RowSource = "Select tblparmedchoices.Substatus " _
& "FROM tblparmedchoices " _
& "WHERE tblparmedchoices.Statustype = '" & Me.cboStatustype & "' " _
& "ORDER BY tblparmedchoices.Substatus;"

End Sub

I have received much help trying to get this working but i thought i might attach an example with the appropriate tables. Basically, im trying to get the substatus combo selection dependent on the statustype. the table tblparmedgroups should help distinguish the selections

any help is much appreciated, i am very lost with this!!

thanks in advance
 

Attachments

combo box code not working.

And the other combo boxes named incorrectly as well!

thanks for this, I have changed where appropriate and also set up the tables slightly differently to reflect one to many relationships, but i still can't seem to get his working. I have attached the DB with wider related tables.

thanks in advance for any help with this, i have been working on this all weekend and its starting to drive me mad.

Simon
 

Attachments

shapman,

Your event is --> cboStatus_AfterUpdate

Your control is --> Status

The event won't fire until you get their names in synch.
Also, in Datasheet View (or Continuous Forms), you shouldn't have the
Name and ControlSource the same.

I'd opt for consistency and set the names back to cboStatus and
cboSubStatus.

Wayne
 

Users who are viewing this thread

Back
Top Bottom