Tekime
Registered User.
- Local time
- Today, 16:17
- Joined
- Jun 26, 2003
- Messages
- 72
I'm relatively new to VBA, and Access in general. I recently designed a DB for entering, processing and analysing chargebacks on our companies merchant account. I have a basic search form which uses a continuous subform to display results, with a detail button to pull up the record. It works okay, but I would like something I can migrate to other forms/apps and is a little more robust in general.
This weekend I started tooling around with a mode-based search facility. I got the idea from our call order management system; there are basically two modes you can be in - Find and Normal. In find mode, all of the order fields go blank and you can enter search criteria in them. Once you hit Enter it refreshes the records with whatever results are found.
SO, I made a small sample DB with one table and one form to test the idea. Right now it's a big hack, but I was interested in getting your ideas on how to make this work for all forms before I dive in head first and start writing all of my code.
Here is the basic idea behind the current method:
There is a mode button on the form. It initially displays "Find" to switch to find mode; once clicked it displays "Browse" to return to Browse mode.
In find mode, code first clears the underlying recordset and then iterates through all textBox controls and sets them as active. It also makes a "Search" button visible. User can enter criteria into any of the fields on the form, and when they hit "Search", the query is dynamically constructed in VBA and the recordset is refreshed with the new query; then the mode is switched back to Browse and the resulting recordset can be viewed.
My major concerns with going ahead on this method are:
- Searching in different types of controls (combo's, currency, etc.)
- Maintaining the original state of the form for browsing (i.e. keeping all active fields active, all inactive fields inactive, colors, etc.)
- Choosing fields that should not be searchable, and vice versa.
It seems like I should probably have a function run on the onLoad event of the given form, which iterates throguh all the controls and records the default control info into so it can be restored later on when returning to browse mode.
Has anybody seen this method in practice before? Do you think this is a big waste of time, or just too much of a project for a VBA n00b? Any insight on this one would be helpful, I really like the idea of having this integrated into my Chargeback DB, but not if it will take 3 months to code!
Also I will attach a copy of the .MDB I made to start testing this stuff. Check out frm_Orders, hit Find and try searching for one of the records. It works OK so far, but it has a looong way to go..
Thank you very kindly for any help.
This weekend I started tooling around with a mode-based search facility. I got the idea from our call order management system; there are basically two modes you can be in - Find and Normal. In find mode, all of the order fields go blank and you can enter search criteria in them. Once you hit Enter it refreshes the records with whatever results are found.
SO, I made a small sample DB with one table and one form to test the idea. Right now it's a big hack, but I was interested in getting your ideas on how to make this work for all forms before I dive in head first and start writing all of my code.
Here is the basic idea behind the current method:
There is a mode button on the form. It initially displays "Find" to switch to find mode; once clicked it displays "Browse" to return to Browse mode.
In find mode, code first clears the underlying recordset and then iterates through all textBox controls and sets them as active. It also makes a "Search" button visible. User can enter criteria into any of the fields on the form, and when they hit "Search", the query is dynamically constructed in VBA and the recordset is refreshed with the new query; then the mode is switched back to Browse and the resulting recordset can be viewed.
My major concerns with going ahead on this method are:
- Searching in different types of controls (combo's, currency, etc.)
- Maintaining the original state of the form for browsing (i.e. keeping all active fields active, all inactive fields inactive, colors, etc.)
- Choosing fields that should not be searchable, and vice versa.
It seems like I should probably have a function run on the onLoad event of the given form, which iterates throguh all the controls and records the default control info into so it can be restored later on when returning to browse mode.
Has anybody seen this method in practice before? Do you think this is a big waste of time, or just too much of a project for a VBA n00b? Any insight on this one would be helpful, I really like the idea of having this integrated into my Chargeback DB, but not if it will take 3 months to code!
Also I will attach a copy of the .MDB I made to start testing this stuff. Check out frm_Orders, hit Find and try searching for one of the records. It works OK so far, but it has a looong way to go..
Thank you very kindly for any help.