Hi i have created all my forms for my database and every thing runs smooth but i would like to have a login form where i can have a combo box that scrolls down showing an option of forms. the thing is i would like it to show only specific forms... or have a nother master combo box which cascade updates the other to select the forms related to that topic. i have seen this before where u click on a command button and it loads the form that is selected in the combo box. thanks in advance for the help.!
p.s Im not very familiar with visual basic code but should be ok providing someone runs through the steps fully with me. thanks again in advance for helping.
The easiest method for you to keep a handle on this is to insert into a table of your own a list of your database forms sitting 'independant' of Access's own method for storing its objects.
You can then assign control elements by creating extra fields in that table where you can then control and store what 'does' and 'does not' happen for instance a field might be called SHOW as a simple Yes/No field tickbox shall we say. You would then base your listing of forms in any dropdown on the contents of this table where Show=True or Show =False.
You are going to have flexibility on this because you can add extra fields to your table to add extra controlling or restrictive elements that you might seek and call back this list in an SQL statement using relevant criteria
ie: "SELECT NameOfForm FROM tblMyListOfForms WHERE Show=TRUE"
and for a listbox as in your case you might want to set the rowsource in much the same way
Depending on your version of Access below is an SQL statement that will retrieve for you a List of Access forms from its MsysObjects table. If you use this in the query Window like So...
- SELECT MSysObjects.Name AS NameOfForm INTO tblMyListOfFormNames
-
FROM MSysObjects
-
WHERE (((MSysObjects.Type)=-32768))
-
ORDER BY MSysObjects.Name;
You will have 'automatically created' for you an independant table as mentioned visible in the Access window that you can work with easier than having to potentially hardcode everything. The only downside to this technique is that you have te remember.... it is an independant table as such so if you create another form it will not obviously be in the table automatically. (Unless of course you find that the technique works so well in your circumstances that you are happy to employ simple methods keep this table updated and synchronised to the current objects in the database. (which you could raise as another thread if you have problems but I suspect you won't) It is a matter for you.
In terms of your extra requirement ie: the interdependant combo boxes this is a regular feature raised often and quite easily sorted out. I'd go with trying out the above firstly and then return when you need to determine your datavalues of one combo based on another. you will get answers on this quite easily in my absence from others. unless I pick up the thread again when I will be happy to assist you.
Hope this helps
Jim