INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Howto:

Fill a Combo Box with the database objects by Tzokas
Posted: 27 Apr 01

I don't know if someone out there someday needed to do this, but because i did, this is the way:

Use the following SQL statements as Rowsource for the control depending on which object you want.

Tables
SELECT MSysObjects.Name FROM MsysObjects WHERE  (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name

Queries
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (MSysObjects.Type)=5 ORDER BY MSysObjects.Name

Forms
SELECT MSysObjects.Name FROM MsysObjects WHERE  (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name

Reports
SELECT MSysObjects.Name FROM MsysObjects WHERE  (MSysObjects.Type)= -32764 ORDER BY MSysObjects.Name

Macros
SELECT MSysObjects.Name FROM MsysObjects WHERE  (MSysObjects.Type)= -32766 ORDER BY MSysObjects.Name

Modules
SELECT MSysObjects.Name FROM MsysObjects WHERE  (MSysObjects.Type)= -32761 ORDER BY MSysObjects.Name


Notes:

1) In case of Tables we want NOT to appear the system tables that start with MSys
2) In case of Queries we exclude the "~" character because in other case the combo box shows objects starting with the "~" char.


Hope this was helpful

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close