Auto search facility module?

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.
 

Attachments

Yes I actually played around with it a little bit this weekend! Not really what I'm looking for though, as I would like the search facility to be part of the form, and be used on any form. I want any form's fields to be used as the search fields based on the current mode of operation.
 
Then why not use the Filter by Form button??
 
Yeah, I may just be better off using filter by form. I haven't played with it too much, and it seems to do what I want for the most part. Except in some of my lookup fields, it gives me data type mismatch errors when I type in a value, it doesn't seem to have a large level of control. But I've had a bunch of stuff hit my lap today, so I won't have time to vest in a new search system if I want to get this app launched in time anyway :(

Thanks for the replies jfgambit.
 
Remeber that when using the Filter by Form option you can search for parts of fields by adding the "*" wildcard to your searches.

HTH
 
Filter with Wildcard "*"
This works great if you're looking for any part of the field, how would you do this if you had the first part of the field for example;
Search all zipcode starting with 017*??
 
Yes.
If you know what is at the beginning use "abc*", a

At the end use "*xyz"

A conbination of the two "*abc*xyz*", if you know the data has those characters in that order somewhere in the field.
 

Users who are viewing this thread

Back
Top Bottom