473,395 Members | 1,675 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Switchboard list box

I want to make a switchboard with a list box to open objects... but i want the list box to be dynamic (as new queries or forms are created, i want them added). so far i have a combo box that selects the type of object (tables, forms, etc.) and a list box that lists all the objects of the type selected in the combo box. but i cannot figure out how to open the objects out of the list box. any help would be much appreciated. (the idea behind the form is that it replaces the database window to prevent users from breaking the database)

thanks in advance
Jun 26 '07 #1
1 2085
ADezii
8,834 Expert 8TB
I want to make a switchboard with a list box to open objects... but i want the list box to be dynamic (as new queries or forms are created, i want them added). so far i have a combo box that selects the type of object (tables, forms, etc.) and a list box that lists all the objects of the type selected in the combo box. but i cannot figure out how to open the objects out of the list box. any help would be much appreciated. (the idea behind the form is that it replaces the database window to prevent users from breaking the database)

thanks in advance
The easiest Method by far is to preface Database Objects with the appropriate 3-character prefixes, then place this code in the AfterUpdate() Event of the List Box as in:
  1. Forms - frmFormName
  2. Queries - qryQueryName
  3. Macros - mcrMacroName
  4. Tables - tblTableName
  5. Modules - mdlModuleName
  6. Reports - rptReportName
  7. Data Access Pages - pgeDataAccessPage

    Expand|Select|Wrap|Line Numbers
    1. Private Sub lstDBObjects_AfterUpdate()
    2. Dim strObjectToOpen As String
    3. strObjectToOpen = Me![lstDBObjects]
    4.  
    5. Select Case Left$(strObjectToOpen, 3)
    6. Case "frm"
    7.   DoCmd.OpenForm strObjectToOpen, acNormal, , , acFormEdit
    8. Case "qry"
    9.   DoCmd.OpenQuery strObjectToOpen, acViewNormal, acReadOnly
    10. Case "mcr"
    11.   DoCmd.RunMacro strObjectToOpen
    12. Case "tbl"
    13.   DoCmd.OpenTable strObjectToOpen, acViewNormal, acEdit
    14. Case "mdl"
    15.   DoCmd.OpenModule strObjectToOpen
    16. Case "rpt"
    17.   DoCmd.OpenReport strObjectToOpen, acViewNormal, , , acWindowNormal
    18. Case "pge"
    19.   DoCmd.OpenDataAccessPage strObjectToOpen, acDataAccessPageBrowse
    20. Case Else
    21. End Select
    22. End Sub
    23.  
Jun 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dejan M. | last post by:
Can you help me? I have 9 forms in the base. 2 forms are opening as single and 7 as datasheet. Thats OK, but when I used Switchboard manager, with him all of my forms are opened as single. How can...
1
by: jimwlee | last post by:
Hi all, I mistakenly deleted my switchboard on the Object Forms view. I recreated it again with the database utility, but the switchboard isn't showing up in the forms view. Any ideas? Thanks in...
2
by: ghadley_00 | last post by:
Hi, Is there a way to have the labels in a MS access database switchboard dynamically generated based on values in a table? I have a table of items (let's call it table Main) , each of which is...
3
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in...
5
by: joebin | last post by:
I accidentally deleted the switchboard item in form list. Anyone know where I can get my switchboard back? The Switchboard Items in table list is still there. I can also view all the switchboard...
1
by: Yetti | last post by:
I would like to create a switchboard showing all tables that would open each table upon selecting the control box. The switchboard manager does not appear to allow you to select specific tables as...
6
by: keri | last post by:
Please help, i'm baffled. I have opened my db and recieved an error on this code which starts the switchboard. As i didn't write this code i'm baffled, and I don't think I have made any changes...
2
by: Doug | last post by:
MS Access 2000 Help says there is an Switchboard Manager in Tools->Add-ins. Only Add-in Manager is there, and no Add-ins are listed. Clicking Add New takes me to an Add-ins directory on C: (empty...
1
geolemon
by: geolemon | last post by:
I have several forms that I've built... Most of them have some sort of VBA code built in somewhere, like: Select a record with the key-value control, and the rest of the controls position to that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.