SubForm Combo Box Requery

madcats

Registered User.
Local time
Today, 14:10
Joined
Jun 24, 2005
Messages
36
I am a newbie to access and am having some difficulty with a subform. I have searched the forum, but could not find an exact match to my problem.

The following is a simplified version of my problem:

Tables: TSerialNumber, TLocation, TSubLocation(Location and SubLocation Fields)

Form: ServiceForm
SubForm: ServiceSubForm
Form and SubForm linked by SerialNumber

In the SubForm: I have 2 ComboBoxes: Location, SubLocation
Location - Row Source is the Table TLocation
SubLocation - Row Source is a Query of SubLocation relating to the Location

I need the SubLocation field to be requeried OnChange from the Location ComboBox.

If I use the subform as a form I can get this to work by using a macro to requery the SubLocation, but when I try to use it as a subform I get an ApplyFilter Error.

Thanks in advance for any help.
 
You want to create what is known as Cascading ComboBoxes

Try this as a search,
 
1) In the Location combo -> property sheet -> Events tab, double-click the OnClick event. It now says "[Event Procedure]"
2) At the far right of that line there are three dots "..." on button. Click.
3) Code window now shows you something like...
Code:
Private Sub cboLocation_Click()
  [COLOR=Green]'and you need this line[/COLOR]
  cboSubLocation.Requery
End Sub
 
Worked perfect

Lagbolt,
It worked perfect, Thanks.
 

Users who are viewing this thread

Back
Top Bottom