Comob box filter

Yippiekaiaii

Registered User.
Local time
Today, 20:41
Joined
Mar 25, 2013
Messages
21
I am trying to apply a filter to a datasheet subform using a combo box.

This is the code I have used on the "after update" event:

[Ordering - Price list items].Form.Filter = "[Secondary Category]=" & Combo72.Column(1)
[Ordering - Price list items].Form.FilterOn = True

When I run the query i get the following error:

Runtime error 3021:
No current record

Im not sure why it isnt working as this is how I have set up other combo box filters and it worked fine.

Any ideas what im doing wrong?
 
Last edited:
Is the other CombBox filter also set up in the On Current event? Try After Update of the Combo..
 
I have this on one of my forms, and it works.... it's on the cboTrainer_AfterUpdate

Code:
Private Sub cboTrainer_AfterUpdate()
 
Form.Filter = "[TrainerID] = " & Str(Nz([Screen].[ActiveControl], 0))
Form.FilterOn = True
 
End Sub
 
Sorry I should have said after update not on current, i already have it on the after update.
 
I have this on one of my forms, and it works.... it's on the cboTrainer_AfterUpdate

Code:
Private Sub cboTrainer_AfterUpdate()
 
Form.Filter = "[TrainerID] = " & Str(Nz([Screen].[ActiveControl], 0))
Form.FilterOn = True
 
End Sub

What kind of control is this working from? Im not familiar with the bit that says "[Screen].[ActiveControl]"?
 
screen.activecontrol = the control on the screen that's currently active - in this case. my cboTrainer (combo box)

So it looks for the value that I've just selected in the combo... just makes it easier if you forget and rename the control afterwards ;)
 
That doesnt work, it gives a type mismatch. I have 2 fields in the combo so I am guessing it is looking at the wrong one with that, I dont think I can go about it that way.
 

Users who are viewing this thread

Back
Top Bottom