StayAtHomeMom
Technical User
I have a database with a form used by my customers where they can select certain criteria in several list boxes. When they’re done choosing their criteria, they push a button that runs code to create a report with a list of items from a table that meets their criteria ( I used DoCmd.OpenReport…)
What I’d LIKE to do is instead of opening a report is open a form with a listbox of all the items that meet the criteria. Because then, I’d like them to be able to click on an item in that listbox which would open a file (using a hyperlink??) showing them a sample of their item (like a .snp file, or Word file).
I’m stuck on how to use OpenForm with my code-created WhereString. What does the form have to have in it? I tried creating a form with a ListBox , with the form itself having a RecordSource of a query that selects everything out of that table I’m using. But it never takes my WhereString into consideration, instead listing EVERYTHING in the table, and not just those meeting the selected criteria. I think it’s because I’m confused about the properties the ListBox should have (ControlSource, RowSource, etc). This is the line in my code that’s invoking my Form, where I’m trying to get it to list only those items that have created the gstrWhere clause.
DoCmd.OpenForm "ListOfReports", , , gstrWhere
Thank you in advance for steering me in the right direction!
What I’d LIKE to do is instead of opening a report is open a form with a listbox of all the items that meet the criteria. Because then, I’d like them to be able to click on an item in that listbox which would open a file (using a hyperlink??) showing them a sample of their item (like a .snp file, or Word file).
I’m stuck on how to use OpenForm with my code-created WhereString. What does the form have to have in it? I tried creating a form with a ListBox , with the form itself having a RecordSource of a query that selects everything out of that table I’m using. But it never takes my WhereString into consideration, instead listing EVERYTHING in the table, and not just those meeting the selected criteria. I think it’s because I’m confused about the properties the ListBox should have (ControlSource, RowSource, etc). This is the line in my code that’s invoking my Form, where I’m trying to get it to list only those items that have created the gstrWhere clause.
DoCmd.OpenForm "ListOfReports", , , gstrWhere
Thank you in advance for steering me in the right direction!