Robin has attended:
Access Intermediate course
Access Advanced course
Option Group
I have a drop down combo box on a form which allows the user to select a record.
I would like to be able to filter the list of available records in the drop down list subject to a yes/no tick box that is set in the source table.
I have created an option group with three options: Current, Old and All.
If the user clicks current, the drop down combo box needs only to contain only those records where the field in the source table is set to true.
The opposite obviously needs to be applied if the user clicks old and the all button would restore the full list.
I'm sure this is simple but I just can't seem to get it to work.
Thanks in advance.
Robin
RE: Option Group
Robin
This will need some VBA coding, but the gist of the code is as follows:
When one of the Options in the Option group is selected code needs to imediately run a query filtering the table to the criteria of the selected option.
The data in this query is then loaded into the Combo box
Regards
Carlos
RE: Option Group
Thanks for your reply.
I originally created seperate queries but solved it as follows:
AfterUpdate.....
Select Case Frame69.Value
Case 1
Combo59.RowSource = "SELECT tblClients.CustomerID, tblClients.CompanyName, tblclients.CurrentClient " & _
"FROM tblClients " & _
"WHERE (((tblClients.CurrentClient) = True))" & _
"ORDER BY tblClients.CompanyName"
Me.Combo59.Requery
Case 2
Combo59.RowSource = "SELECT tblClients.CustomerID, tblClients.CompanyName, tblclients.CurrentClient " & _
"FROM tblClients " & _
"WHERE (((tblClients.CurrentClient) = False))" & _
"ORDER BY tblClients.CompanyName"
Me.Combo59.Requery
Case 3
Combo59.RowSource = "SELECT tblClients.CustomerID, tblClients.CompanyName FROM tblClients ORDER BY tblClients.CompanyName;"
Me.Combo59.Requery
End Select