View Full Version : Use of multiple copies of the same database within the database itself


Macedon
08-25-2011, 02:33 PM
I have made a database to run the annual proceedings of a school business with many clients. Everything is done and controlled in a single form with 5 pages (along with 5 tables, 6 queries and 2 reports). I would like to create multiple forms of EXACTLY the same structure and then combine them in a navigation form with multiple pages, one for each school year.

How can I do it more easily and efficiently? Isn't there a way to somehow automatically use a copy of the same tables, queries and reports with a new name (2012/13 instead of 2011/12) recognized by a copy of the form in question (again 2012/13 instead of 2011/12) and then use both? Or is there a way to draw a form from multiple databases? Maybe a switch that makes it possible to choose which database to open?

GinaWhipp
08-25-2011, 03:23 PM
Ummm, don't do that. Instead create a YearMonth field and then filter for the current year. (You can have that field fill automatically in the background. Then if you ever have to go back you can use a query or better yet, create a form for historical.

Macedon
08-26-2011, 01:34 AM
Thanks, yes, that is easy indeed but can I somehow have a "filter" button with a number of prearranged filters (one for each schoolyear)? You see, the girls operating this database will be as computer literate as necessary to know we do not just unplug the PC when we want it to shut down, so I try to make this as easy as possible for them to not mess things up...

I found some relevant code on the net I am exploring now... Could it be possible that I can have, let's say 10 buttons, each with one schoolyear assigned as a filter but when multiple buttons are pressed have the filters run in an "or" fashion?

Like when pressing 2011/12 and 2010/11 to have all entries from 2010/11 and 2011/12 appear in the form?

CBrighton
08-26-2011, 02:19 AM
You can use a combobox to feed the .filter of the form.

The combobox rowsource can list exactly what options you want the end user to be able to select.

You can also use a DISTINCT query as the rowsource which would mean it automatically shows every different value currently in that field (i.e. "SELECT DISTINCT Department FROM tblStaffData" would return a list of every value which is in the Department field in the table tblStaffDetails, without showing any duplicates).

:edit:

If you want the users to have a selection of possible criteria, more than just a single field such as year, then I advise doing a search on this forum for "search forms". There are many threads on them and they almost all contain links to detailed posts on the subject.

One of my main databases has a form to dynamically set criteria across 3-4 dozen fields combioned with cascading comboboxes which allow the user to choose which report to view with the selected criteria applied to the .filter property.

:edit2:

Alternatively, for selecting multiple years a listbox with multiple seelctions enabled would be better than a combobox. Then the VBA just needs to loop through the selected values in the listbox to concatonate an SQL statement for the .filter.