Okay. I have it now. I really have it.
First, before we get to the programming, the setup:
1. Agency control, which I will name ctlAgency
2. Asset control, which I will name ctlAsset
3. Attribute control, which I will name ctlAttribute
Your control names will vary.
4. What you know of as "the form" will now be placed in the "Form Header" section of the form. All of it. All of the comboboxes, etc. Move them to the header. This will break all events related to your controls--there is no help for that. This makes way for...
5. The detail part of your form. This you will set to "Datasheet", thus looking the most like a table, and the simplest way to list the data. The other option is Continuous, but that's for later, if you want to do some formatting. This is your embodiment of the "visual result" of your querying.
6. Anything you want to appear below all the listed items, put in the footer. But that's a matter of taste; I leave it up to you.
7. The form's current recordsource is empty/blank. We will fill this in later.
Now, for the pseudocode:
Stage 1: fill in information on comboboxes
Stage 2: user clicks "Search" -- run search
((***))
Stage 3: update form to list search results
((***)) - I'd recommend that you only run the query when the user chooses to.
Stage 1 requires no coding.
Stage 2: On the Click() event of the search button, dynamically create your SQL string based on what is currently in your comboboxes.
Stage 3: After you have assembled the SQL, do the following line:
Code:
Me.RecordSource = strSQL 'or whatever the name of your string is
This hasn't given you the exact answer--but I can't give you the exact answer without a lot more detail. But I believe that is what you're after. To visually represent your newly-assembled SQL statement, assign it to the form's recordsource and it will automatically requery and display the information.
--
Find common answers using Google Groups:
Corrupt MDBs FAQ