473,399 Members | 3,919 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,399 software developers and data experts.

List Box with all tables, queries and forms of my database

44
Hi,

is there any VBA code I can try to get all tables, queries and forms of my database selected and displayed in a list box of a form? And also the list box must be always held the current vlaues. Meaning if I enter a new table or form, the list box needs to show it.

Any help is much appreciated. :)

Thanks
Oct 17 '06 #1
5 4764
MMcCarthy
14,534 Expert Mod 8TB
Create a lookup table called ObjectType as follows:

TypeID TypeDesc
====== ========
1 Table
5 Query
-32768 Form
-32764 Report

You could then use a query on the Msysobjects table as follows:
SELECT DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type]) AS ObjType, MsysObjects.Name
FROM MsysObjects
WHERE (((DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type])) Is Not Null) AND ((MsysObjects.Name) Not Like '~*' And (MsysObjects.Name) Not Like 'MSys*'))
ORDER BY DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type]), MsysObjects.Name;



Hi,

is there any VBA code I can try to get all tables, queries and forms of my database selected and displayed in a list box of a form? And also the list box must be always held the current vlaues. Meaning if I enter a new table or form, the list box needs to show it.

Any help is much appreciated. :)

Thanks
Oct 18 '06 #2
isetea
44
I did like you said. But it is given me an error message saying "data type mismatch in criteria expression". Also I can't exit the error message any more, need to end task via task manager.
Are you sure it works?

Create a lookup table called ObjectType as follows:

TypeID TypeDesc
====== ========
1 Table
5 Query
-32768 Form
-32764 Report

You could then use a query on the Msysobjects table as follows:
SELECT DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type]) AS ObjType, MsysObjects.Name
FROM MsysObjects
WHERE (((DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type])) Is Not Null) AND ((MsysObjects.Name) Not Like '~*' And (MsysObjects.Name) Not Like 'MSys*'))
ORDER BY DLookUp("[TypeDesc]","ObjectType","[TypeID]=" & [MsysObjects].[Type]), MsysObjects.Name;
Oct 18 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
In the lookup table ObjectType did you declare the TypeID as a Number (Long Integer).

I tested the query and it did work.


I did like you said. But it is given me an error message saying "data type mismatch in criteria expression". Also I can't exit the error message any more, need to end task via task manager.
Are you sure it works?
Oct 18 '06 #4
isetea
44
:o
No I did not! Sorry.

It's working now. I needed to add Tpe 6 as well because there were linked tables.

Thanks very much for you help! :)

In the lookup table ObjectType did you declare the TypeID as a Number (Long Integer).

I tested the query and it did work.
Oct 18 '06 #5
This worked in the query but I was not able to view the field "Names" in the list box of the form. The only field that was displayed was ObjType.
Feb 24 '08 #6

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

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
2
by: Jonathan LaRosa | last post by:
Hi all - I'm wondering if anyone has (or knows of) a tool that will allow me to search through VB code, tables, queries, reports, forms, and other objects, for references to all other types of...
5
by: Sean Byrne | last post by:
We have a Microsoft Access 2000 database consisting of 20 tables covering 20 different events. In each table, there are 3 Team members, a date of the event and several unique fields for the event,...
1
by: Julia | last post by:
Hello there. I have a question somewhat related to this topic, and I don't know where else to go. I hope somebody can help. I've created a database in access, that I'd like to share with less...
3
by: Kevin Forbes | last post by:
So, I've found how to list all the tables in an Access database (as seen below) and running MS Access queries is easy (similar to executing a stored procedure), but how do I list the names of all...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
3
by: dstorms | last post by:
Hi there, I'm developing a database for my company, and for the most part I've been successful, with some complex sub-routines already working fine. But this one has me stumped! Some background...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.