473,382 Members | 1,258 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,382 software developers and data experts.

display list of tables in access form to select from

2
I am trying to create a form that will display a list of tables that one can be selected from, to then run a query to select data from that table. [ the tables are a year based table of same data -- membership], and query can select same data from any of the tables.
Nov 16 '20 #1
6 2329
cactusdata
214 Expert 128KB
Bad design. Move all membership data to one table including a field for the year.
Next, run a select query that filters on the selected year(s).
Nov 16 '20 #2
isladogs
455 Expert Mod 256MB
Agree completely with @cactusdata.
However if you want code to view a list of tables in a form listbox, I have an example View Database Objects app on my website.
I'm not allowed to post a link here due to forum rules but you can find it by doing a Google search for View database objects Mendip Data Systems
Nov 16 '20 #3
twinnyfo
3,653 Expert Mod 2GB
A simple approach is to use the following query to list your tables (this will also include linked tables):

Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name
  2. FROM MSysObjects
  3. WHERE MSysObjects.Type = 6
  4. ORDER BY MSysObjects.Name;
Hope this hepps!
Nov 16 '20 #4
isladogs
455 Expert Mod 256MB
The code supplied by twinnyfo will ONLY find linked Access/Excel/text tables. Local tables won't be listed.

If you need local tables, those have MSysObjects.Type=1 & ODBC tables such as SQL Server have MSysObjects.Type=4

To get all tables, you need:
Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name
  2. FROM MSysObjects
  3. WHERE MSysObjects.Type IN (1,4,6)
  4. ORDER BY MSysObjects.Name;
That code will also list system tables which you probably don't want. So a further modification will exclude them but show all other local & linked tables:
Expand|Select|Wrap|Line Numbers
  1. SELECT MSysObjects.Name
  2. FROM MSysObjects
  3. WHERE ((Not ((MSysObjects.Name) Like "MSys*" 
  4. Or (MSysObjects.Name) Like "USys*" 
  5. Or (MSysObjects.Name) Like "f_*")) 
  6. AND ((MSysObjects.Type) In (1,4,6)))
  7. ORDER BY MSysObjects.Name;
  8.  
Nov 16 '20 #5
John Y
2
Thanks for your replies and advise ... How ever I inherited this and was looking for an easy way to solve the problem ..

As member year info is in different year tables [ membership 1991 ... 1992 etc] this creates problem of getting a year field in master database filled with each members year of membership..
and my knowledge in Db mods is no where near professional..

That is why i was trying to get around it by being able to select year db and run query on it..

I have the query that selects the tables, but can not get it to display in a form in a list box that can be selected from, to run other query on that selected table ..

Maybe I should ask "Is this possible" ..??

Any Help would be appreciated ...
Nov 17 '20 #6
twinnyfo
3,653 Expert Mod 2GB
isladogs,

Thanks for the correction for type 1 -- I happened to be looking at a DB that had all linked tables....

--------------

John,

Just assign the query described above at the row source for your list box or combo box. Then use the value of that control to execute your other actions.

However, your bigger, more glaring, more "elephant in the room" issue is your table design. Just combine all your tables into one.

As IslaDogs recommended, create a new table with all the same fields you have now, but add a field for year. Then (this will take a bit of time) append all your data from the original tables to the new table, updating the Year accordingly.

Hope this hepps!
Nov 17 '20 #7

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

Similar topics

3
by: Michael Ramey | last post by:
How can controls on a Windows Form be accessed (or referenced) from another Class? I know how to do it from another Form. The following doesn't work even though the Control Modifiers property is...
2
by: Sam | last post by:
Access quickie question- Have a table called ValidAxes. Design as follows- FieldName Type Null OK ? -------------------------------- ProcessType Text NO EEType Text ...
6
by: Mark | last post by:
Hello. I have an MS Access 2000 form whose fields I need to read and write from VBA. The fields are data-bound, using a query that has been defined and saved in my Access database. The query...
1
by: Mike | last post by:
Hi all, Hum i just erased the whole message by mistake, :( Ok so i want to hide a specific field in an Access form using a toggle button, but i cant seem to get the right syntax. Right now im...
3
by: vern | last post by:
Hi All I am not a developer, but am trying to put together a small Access program for tracking patients in a clinic. Here is where I HELP. Form 1 I have created a form that shows patient...
5
by: Jon E. Scott | last post by:
I'm a little confused with "static" methods and how to access other unstatic methods. I'm a little new to C#. I'm testing a callback routine within a DLL and the callback function returns a...
1
by: stierle | last post by:
Background: I'm using Access 2000 and have a form with several listboxes on it (listB, listP, listT) I'm need to find a way to link items from different boxes. I have a matchID in the table and...
2
by: kkk1979 | last post by:
Hi, I have been using access 2000. I have created a form where I put labels and a button to display report. I have populated the labels of that form by using so many tables and calculations. The...
5
by: lisa007 | last post by:
i have 3 drop down lists as long the user selects one of the option from one of the drop downs pass validation but if users don't select an option from at least one of the drop down fail validation....
0
by: starlight849 | last post by:
I'm using VB.net in Visual Studio 2008. I have a frmMain with a progress bar.. I have another class file that frmMain is calling. This class file will loop through some data and then eventually...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.