[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access 2003 - Combo box does not filter form after using toolbar (or right-click) remove filter.

Posted on 2011-10-31
7
Medium Priority
?
454 Views
Last Modified: 2013-11-28
Have a continuous form that has a combo box to filter for records by name.  It works until you use remove filter using the toolbar or right click method.  
0
Comment
Question by:mlaurin
  • 5
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37058175
Please post the code for the combo box (combobox afterupdate event procedure I would expect)
0
 

Author Comment

by:mlaurin
ID: 37058424
Here it is:

Private Sub Analyst1_AfterUpdate()
Me.Requery
End Sub
0
 
LVL 13

Accepted Solution

by:
lee555J5 earned 2000 total points
ID: 37058623
Is Analyst1 the name of the combobox?

If it is, replace the whole Sub with the attached code.

Build your filter statement based on the BoundColumn of the combobox.
Examples:

If the combobox has only 1 column (LastName) and the form has a LastName field,
filter_expression: "LastName = " & Chr(39) & Analyst1 & Chr(39)

If the combobox has 2 columns (EmployeeID and EmployeeName) and the bound column is the first,
filter_expression: "EmployeeID = " & Analyst1

The Chr(39) is the single quote and it is usually clearer to use this instead of stacking lots of single and double quotes together. Use single quotes to equate strings.

Lee

Private Sub Analyst1_AfterUpdate()

  Me.Filter = Put your filter_expression here
  Me.FilterOn = True

End Sub

Open in new window

0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

Author Comment

by:mlaurin
ID: 37058889
That worked!  I originally put the filter in the query field which works great except if used in combination with the toolbar filter.  So thanks for the solution that does work.
0
 

Author Comment

by:mlaurin
ID: 37059035
I've requested that this question be closed as follows:

Accepted answer: 0 points for mlaurin's comment http:/Q_27424025.html#37058889
Assisted answer: 500 points for lee555J5's comment http:/Q_27424025.html#37058623

for the following reason:

Thanks!!
0
 

Author Comment

by:mlaurin
ID: 37059023
Made a mistake with accepting.  Not sure how it happened that my comment shows as accepted.  It should only be ee555J5's.  
Will try to figure out how to change this!
0
 

Author Comment

by:mlaurin
ID: 37059036
Made a mistake with accepting.  Not sure how it happened that my comment shows as accepted.  It should only be ee555J5's.  
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question