Create a list box that contains a list of forms

  • Thread starter Thread starter urluckee
  • Start date Start date
U

urluckee

Guest
I want to create a list box that contains a list of forms and another with a list of reports. Once someone selects an item in the list and clicks go they will be taken to that form or report. Can someone help?
 
Don't want to ruin your fun of developing this on your own so will provide this for a starter.

Copy/paste this to a new query in your database, then run the query and respond to the prompt.
You'll be greeted with either a list of forms or reports in your database, depending on how you respond. This query could serve as the row source of your listbox.
Code:
SELECT MSysObjects.Name, MSysObjects.Type
FROM MSysObjects
WHERE (((InStr([Name],"MSys"))=0) 
AND ((InStr([Name],"~"))=0) 
AND ((MSysObjects.Type)=IIf([Enter 'Form' or 'Report]="Report",-32764,-32768)))
ORDER BY MSysObjects.Name;
Be advised that we're likely to be greeted with responses from alarmists who'll say
"...but MS may not support the MSys method in the future". Not to worry, there are other ways to accomplish this.

Please post back with your questions.

Bob
 
Is there a way to filter only select forms. We are using the following in row source of a list box
SELECT msysobjects.Name FROM msysobjects WHERE msysobjects.Type=-32768
if i put something in the form name, maybe? example (Form1*)
 

Users who are viewing this thread

Back
Top Bottom