combo form filter

  • Thread starter Thread starter ljg08
  • Start date Start date
L

ljg08

Can anyone help with this issue please

I have a form to list clients. On the form I have a combo box with a list of
events

I want the users to select an event from the combo box and filter the fom
data to list just the clients interested in this event.

I have a text box on the form [txteventID] which gets the value of the combo
selection

Private Sub cboevent_AfterUpdate()
Me.txteventlID = Me.cboevent
End Sub

and have tried :

SELECT tblcontact.userID, tblcontact.eventlID, tblcontact.contact_last,
tblcontact.contact_first
FROM tblcontact
WHERE (((tblcontact.referalID)=[Forms]![frmEvents]![txteventlID]));

Whilts the value fills the text box the data is not filtered?
 
If the SQL you're showing is the RecordSource of your form, you need to
requery the form:

Private Sub cboevent_AfterUpdate()
Me.txteventlID = Me.cboevent
Me.Requery
End Sub

I don't see the point of the text box, though, to be honest, Why not simply
refer to the combo box in your SQL? (You'd still need the requery)
 
Cheers, Thanks for that Douglas..doh....I knew it would be something simple.

I have taken the text box out now. I only had that their to act as a source,
and make sure the value was being passed.

Many thanks

Douglas J. Steele said:
If the SQL you're showing is the RecordSource of your form, you need to
requery the form:

Private Sub cboevent_AfterUpdate()
Me.txteventlID = Me.cboevent
Me.Requery
End Sub

I don't see the point of the text box, though, to be honest, Why not
simply refer to the combo box in your SQL? (You'd still need the requery)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


ljg08 said:
Can anyone help with this issue please

I have a form to list clients. On the form I have a combo box with a list
of events

I want the users to select an event from the combo box and filter the
fom data to list just the clients interested in this event.

I have a text box on the form [txteventID] which gets the value of the
combo selection

Private Sub cboevent_AfterUpdate()
Me.txteventlID = Me.cboevent
End Sub

and have tried :

SELECT tblcontact.userID, tblcontact.eventlID, tblcontact.contact_last,
tblcontact.contact_first
FROM tblcontact
WHERE (((tblcontact.referalID)=[Forms]![frmEvents]![txteventlID]));

Whilts the value fills the text box the data is not filtered?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top