Do not understand this one:
SELECT
Table_Name = Name,
Row_Count = DCount("*",[MSysObjects].[Name])
FROM
MSysObjects
WHERE
(Left([Name],1)<>"~")
AND (Left([Name],4) <> "MSys")
AND ([Type] In (1, 4, 6))
ORDER BY
Name
My tables are: FES02AVTALL, FES02GRDALL, and each after etc.
this one works but returns the total number on rows that never stop:
SELECT
(Select Count(Process) From FES02AVTALL) As FY02AVT,
(Select Count(Process) From FES02GRDALL) As FY02GRD,
(Select Count(Process) From FES03AVTALL) As FY03AVT,
(Select Count(Process) From FES03GRDALL) As FY03GRD
From FES02AVTALL, FES02GRDALL, FES03AVTALL, FES03GRDALL;
all help is appriciated.
Sam
7 7542 @samvaldez
Hello Sam, I wrote some very simple code for you that will list each Linked Table's Name along with the Number of Records contained within. - Dim tdf As DAO.TableDef
-
-
For Each tdf In CurrentDb.TableDefs
-
If Len(tdf.Connect) > 0 Then 'it is a Linked Table
-
Debug.Print tdf.Name & " has " & DCount("*", tdf.Name) & " Records!"
-
End If
-
Next
Okay, created a command button reads like:
Private Sub Command72_Click()
Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
If Len(tdf.Connect) > 0 Then 'it is a Linked Table (this is green out)
Debug.Print tdf.Name & " has " & DCount("*", tdf.Name) & " Records!"
End If
Next
End Sub
I did not recive anything, have I done something wrong?
@samvaldez
I did not receive anything, have I done something wrong?
No, it simply means that you have no Linked Tables. To verify this, expand the previous code to: - Dim tdf As DAO.TableDef
-
-
For Each tdf In CurrentDb.TableDefs
-
If Len(tdf.Connect) > 0 Then 'it is a Linked Table (this is green out)
-
Debug.Print tdf.Name & "[Linked] has " & DCount("*", tdf.Name) & " Records!"
-
Else
-
Debug.Print tdf.Name & "[Non-Linked] has " & DCount("*", tdf.Name) & " Records!"
-
End If
-
Next
P.S. - I intentionally did not filter out the System Tables to keep things simple,
I am working with 2007 Access.
the db i'm working in is the front end that users access. all tables are linked.
I'm i doing this correct with a command button?
Is their anything else I should do prior to copy and paste into the event of the button?
this is how command72 event reads:
Private Sub Command72_Click()
Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
If Len(tdf.Connect) > 0 Then 'it is a Linked Table
Debug.Print tdf.Name & "[Linked] has " & DCount("*", tdf.Name) & " Records!"
Else
Debug.Print tdf.Name & "[Non-Linked] has " & DCount("*", tdf.Name) & " Records!"
End If
Next
End Sub
-------------------------
will the data open in a table?
Thanks
@samvaldez
I just realized that I may have made an assumption that I should not have, and that is that you know how to access the DEBUG/Immediate Window. After executing this code, press the CTRL + G Key Combination to Open the DEBUG/Immediate Window. Another Option is to replace the Debug.Print Statement with Msgbox.
Great!
Changed to Msgbox. However, it is only returning non-linked tables.
is their also a way to have all listed in one box or querry/table?
thanks for your help.
Sam
@samvaldez
Copy and Paste the following SQL Statement into the SQL View of the Query Design Window and everything that you request will be in the Form of a Query. -
SELECT MSysObjects.Name,IIF([Type]=4,'Linked','Non-Linked') As Status,
-
DCount("*",[MSysObjects].[Name]) AS[Record Count]
-
FROM MSysObjects
-
WHERE (((Left([Name],1))<>"~") AND ((Left([Name],4))<>"MSys") AND
-
((MSysObjects.Type) In (1,4,6)))
-
ORDER BY MSysObjects.Name;
Sample OUTPUT for my PC: -
Name Status Record Count
-
Bkup_Ctrl Non-Linked 1
-
Categories Non-Linked 8
-
Customers Non-Linked 93
-
dbo_authors Linked 23
-
dbo_titles Linked 18
-
Employee_ImportErrors Non-Linked 225
-
Employees Non-Linked 9
-
Employees2 Non-Linked 1
-
Horatio Non-Linked 10
-
Order Details Non-Linked 2158
-
Orders Non-Linked 856
-
Products Non-Linked 77
-
ServiceRec Non-Linked 10
-
Shippers Non-Linked 3
-
Suppliers Non-Linked 29
-
Table1 Non-Linked 6
-
TBL_DATA Non-Linked 4
-
tbl_EXTRACT_070709 Non-Linked 1
-
tblAccount Non-Linked 9
-
tblCrop Non-Linked 5
-
tblDOS Non-Linked 4
-
tblEMailAddress Non-Linked 4
-
tblEmployee Non-Linked 225
-
tblKeywords Non-Linked 4
-
tblOrders Non-Linked 9
-
tblPrefixes Non-Linked 3
-
tblReports Non-Linked 2
-
tblSales Non-Linked 3
-
tblSuffixes Non-Linked 4
-
tblTest Non-Linked 6
-
tShipDetails Non-Linked 16
P.S. - Sorry, simply do not have the time to properly Format the results.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Henry Stockbridge |
last post by:
Hi,
I am doing database documentation and run the procedure below to list
the record count for each table in the database. The results in the
immediate window only a partial listing of tables. ...
|
by: jnikle2100 |
last post by:
I have a simple database comprised of two tables. tbl_employee_info
stores employee info (name, hire date, title, etc.) and
tbl_departmental_history stores departmental transfer history. The two...
|
by: brettclare |
last post by:
I have linked a large SQL Server table to Access, however 'only'
2,195,439 records are shown and are available to query. Can I increase
the size (cache??)/number of records showing in Access?
...
|
by: Rashapoo |
last post by:
I have just completed a basic course in Access. I have some relational
b/g in DB2 and Cobol. I have a question my instructor couldn't answer
(or maybe I didn't explain myself)
I design a...
|
by: Peter W Johnson |
last post by:
Hi guys,
I have a problem with a datagrid record count. Here is the code:-
<snip>
Public Class frmMerchantDeposit
Inherits System.Windows.Forms.Form
Dim myconnection As New...
|
by: gerbski |
last post by:
Hi all,
I am relatively new to ADO, but up to now I got things working the way
I wanted. But now I've run into somethng really annoying.
I am working in MS Access. I am using an Access...
|
by: Neil |
last post by:
I'm running Access 2000 with a SQL 7 back end, using ODBC linked tables in
an MDB file. The db is used by about 30 users on a LAN, and an additional 10
or so on a WAN.
Recently, one of the WAN...
|
by: ARC |
last post by:
I'm having trouble here with Access 2007 and connecting to a different
database.
The code below works great IF the previous back-end database connection is
still present and you are trying to...
|
by: thayes5150 |
last post by:
I have an Access 2003 database linked to an MS SQL 2005 backend. We use the database as part of a process whereby we use Zone OCR to scan records off paper forms into an XML file, suck the data off...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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: 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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |