473,503 Members | 5,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

get number of fields in a table?

Folks,
Once you have created a table, by importing, etc, is there anyway to
easily look up how many fields are in it? Counting in the design view
or table view is not very accurate.

Tx
Judith

Jun 9 '06 #1
3 9307
j.******@cox.net wrote:
Folks,
Once you have created a table, by importing, etc, is there anyway to
easily look up how many fields are in it? Counting in the design view
or table view is not very accurate.

Tx
Judith


Press Ctl-G to bring up the VBA immediate window and type...

?CurrentDB.TableDefs("TableName").Fields.Count <Enter>
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 9 '06 #2
Rick, Thanks, you got my question right but I tried it and it didn't
work. Is there a point and click solution? It will be hard for me to
remember this one even if I can get it to work. I'm not too VBA
literate.

Tx
Judith
Rick Brandt wrote:
j.******@cox.net wrote:
Folks,
Once you have created a table, by importing, etc, is there anyway to
easily look up how many fields are in it? Counting in the design view
or table view is not very accurate.

Tx
Judith


Press Ctl-G to bring up the VBA immediate window and type...

?CurrentDB.TableDefs("TableName").Fields.Count <Enter>
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Jun 11 '06 #3
j.******@cox.net wrote:
Rick, Thanks, you got my question right but I tried it and it didn't
work. Is there a point and click solution? It will be hard for me to
remember this one even if I can get it to work. I'm not too VBA
literate.


Well it sounded like you wanted a one-time way to get the field count, not
something that you would use over and over. If you want that then you need to
build a custom function that takes a table name as an argument and returns the
field count.

Put the following in a standard module...

Function FieldCount(TableName As String) As Byte
FieldCount = CurrentDb.TableDefs(TableName).Fields.Count
End Function

....then to get the field count of any table...

=FieldCount("TableName")
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Jun 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3683
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
1
366
by: Vladislav Moltchanov | last post by:
In Access 2000 help one can find the topic Microsoft Access database table specifications which contains the line: Number of characters in a record (excluding Memo and OLE Object fields) ...
0
1481
by: Megan | last post by:
Hi Everybody- I know that this is a really, really long post, but I wanted to try to give you as much background as possible. So here's a quick overview of the issues I'm asking for help with:...
7
7228
by: astro | last post by:
Anyone have suggestions on where to troubleshoot this error? Background: -Access 2k v. 9.0.6926 sp3 - front and backend on production server (wiindows 2k) -accessed via Citrix -front-end is...
2
1990
by: ozgirl via AccessMonster.com | last post by:
Hi, hopeing someone can help me here... I have a deductions table and form and want to be able to add many deductions to the table by having only a few fields on the form form fields:...
2
2236
by: John | last post by:
I have two tables in a 1:M relationship- the parent has 5 fields in the primary key and the child 6 (these are actually pretty far downstream in a complicated ER model, but the problem is between...
8
3970
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
3
2763
by: nfrjob | last post by:
Hi there, I'm an advanced beginner, so please bear with me... I have a simple table that has four fields in it: Zone (which will store a three letter code such as ABC), Year (a four digit number...
1
1553
by: Karl | last post by:
In an mde with only custom menus I use transferspreadsheet to transfer data from an Excel worksheet to a new Access 2000 table and the users need to preview the data in the table. The names of...
8
1827
by: Elfae | last post by:
I have searched high and low for a sample for this, and I just can't find any. Sorry for the length! Background Information The issue revolves around setting up a system-generated increase in...
0
7207
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
7093
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
7468
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
5598
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,...
1
5023
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...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.