I saw some past threads about creating search/filtering forms in Access 2010, but I'm still having some trouble.
My database has several tables which I've combined in a union query, and I'd like to create a form that will basically search a user name and show me all of the records associated with that name in a subform. So far, I've got an option box for user name, but the subform only shows me a list of all users, not just the one chosen in the option box.
How do I get the subform to list only those records associated with the selected name?
You have to set the criteria for your query to use the value in the option box. And then create a onChange event ofr the option box to requery your form.
Thanks for getting back to me so quickly. This is exactly where I'm running into trouble. Apparently, I've forgotten how to do all of that... It's been a long time for me.
So, I've built a query to pull data from the union query, and in the criteria of user name I have this expression "[Forms]![Licensing_Search]![Combo7].[OnChange]". So it's looking to that option field in the form and requerying based on changes. Is that right?
I'm also lost on the OnChange event to requery the form...
Personally I would use the "After Update" event procedure of the Combo7 list box.
use the following code
me.subformname.requery
where subformname is the actual name of your subform, the Access VBA Editor will offer you a list of controls which should include the subform name when you type the period (.).
Your Query Criteria should be
[Forms]![Licensing_Search]![Combo7]
Now... If I want to create two search fields - say, another for the serial number of the computer - do I need to create a second query? I entered the same information for Combo9, but it's looking to the same query as Combo7, and I think it's just creating a conflict. Is there a way to include "If USERNAME is Null then..." for the query criteria in the serial number field?
To give you some background, I'm creating a simple tool for my technicians to see what users and computers are licensed for which software. My plan is tie this into SharePoint later, once I have all the forms and queries built.
It might be better to use the iif(isnull([USERNAME]), "something goes here", "or something else goes here") in a Column heading and then apply the Criteria to that new column, or split it in to 2 columns each with their own Criteria.
To have Access find more than one field that must match their criteria they go on the same criteria Row, if you want it to find both, or either one or the other field matching the Criteria they should go on separate Rows.
Yes, if you put them all in the same row it is AND, in serarate rows it is OR
Status
Not open for further replies.
You have insufficient privileges to reply here.
Related Threads
?
?
?
?
?
Tech Support Guy
9.9M posts
859.7K members
Since 1998
A forum community dedicated to tech experts and enthusiasts. Come join the discussion about articles, computer security, Mac, Microsoft, Linux, hardware, networking, gaming, reviews, accessories, and more!