View Full Version : Filtering & Making changes to DB on the one form


darbid
09-01-2008, 10:53 PM
I have inherited a DB and forms from my boss. (his baby)

It has one form populated with textboxes and comboboxes (about 10 in total - we are not talking huge here) which all have a control source being something from the table of the DB.

For Filtering
Up until now he has used the "Filter by Form" and then "Filter" buttons from the menu bar.

The same form is also used to add a new record. :mad:

He now wants the menu bar to dissappear and all functions to be contained on the ONE form.

So this form has to filter and be able to add new records.

So i have found things like this
http://www.access-programmers.co.uk/forums/showthread.php?t=152276&highlight=filter+form

Which uses unbound controls in order to add something to a query.

So what I thought I would do is simply allow two "modes" on this form

The form opens with bound controls. But then have a button "Search Mode"

Search "Mode" with VBA code would for each control:
Me.NameofControl.ControlSource = ""

Then I would be able to use something like the example above.

Am I heading in the right direction or should I do this another way?

darbid
09-02-2008, 02:43 AM
but ahhhhhhh I have as a footer a continous form which will show the results and if I change the Control Source above then it will also change in the footer(continous form) as well.

edit - please forget this post i do not know what I was talking about.

darbid
09-02-2008, 05:33 AM
I have been doing some testing and think that I have a solution in Theory.

Upon load my 10 or so text and combos all have
Me.nameofcontrol.ControlSource = ""

This leaves them blank and people can enter anything they like into them.

I have a search button which takes the info from each Not isNull control and builds a string for a filter.

The results of the filter are shown in the footer part of the form and people can click on a result to do (whatever i then choose to code)

Another button on this form will have "Changes Mode" on it. This will basically add the proper control source to each control so that either a new record can be made or a current record can be changed.

Comments are welcome.