Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown that shows tables

Status
Not open for further replies.

Jahappz

Technical User
Jun 3, 2002
133
SE
Hi there i have this problem, i want to have a form where i have a drop down box that lists all available tables in the database, so if a user creates a new table its automatic listed in the dropdown box, and the selected tables posts should be listed , anyone have a sample db with this function???

thanks!
 
SQL for ComboBox show All Tables Except System Tables
Code:
SELECT MSysObjects.Name, MSysObjects.Connect FROM MSysObjects WHERE (((MSysObjects.Name) Not Like "MSys" & "*") AND ((MSysObjects.Type)=1 Or (MSysObjects.Type)=4 Or (MSysObjects.Type)=6)) ORDER BY MSysObjects.Name;

SQL for ComboBox show All Tables including System Tables
Code:
SELECT MSysObjects.Name, MSysObjects.Connect FROM MSysObjects WHERE (((MSysObjects.Type)=1 Or (MSysObjects.Type)=4 Or (MSysObjects.Type)=6)) ORDER BY MSysObjects.Name;
hope this helps

________________________________________________________________________
Zameer Abdulla
Visit Me
A sweater is usually put on a child when the parent feels chilly.
 
can you get the same without system tables?
 
SELECT [Name], Connect
FROM MSysObjects
WHERE [Name] Not Like "MSys*" AND [Name] Not Like '~*' AND [Type] In (1, 4, 6)
ORDER BY 1;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
First one will bring it, I used "Except" instead of "Without"

________________________________________________________________________
Zameer Abdulla
Visit Me
A sweater is usually put on a child when the parent feels chilly.
 
Yes the dropdown works perfect!

if i want to list the selected table's posts in a submenu is there an easy way to make that also?
so you can edit posts...?
 
Put this on AfterUpdate Event of the Table Select Combo
Code:
Private Sub select_AfterUpdate()
    Dim MyTable As Variant
    Set MyTable = Me.select
    Me.rows.Form.RecordSource = Me.select.Value

    Me.rows.Form.Text3.ControlSource = CurrentDb.TableDefs(MyTable).Fields(0).Name
    Me.rows.Form.Text5.ControlSource = CurrentDb.TableDefs(MyTable).Fields(1).Name
End Sub
hope this helps

________________________________________________________________________
Zameer Abdulla
Visit Me
Children are poor men's riches.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top