473,586 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

table Column count in Access

Hi
I use Access2000 and am trying to count the number of columns in a
table in VBA
Does anyone know if this possible?
thanks
KC

Sep 29 '06 #1
2 7262
"KayC" <ka******@yahoo .co.ukwrote in message
<11************ **********@b28g 2000cwb.googleg roups.com>:
Hi
I use Access2000 and am trying to count the number of columns in a
table in VBA
Does anyone know if this possible?
thanks
KC
If you have opened a recordset based on the table, you can use

msgbox rs.fields.count

Without, you can do something like this with a DAO tabledefs object

msgbox currentdb.table defs("tablename ").fields.c ount

Or with ADO, you could do

msgbox _
currentproject. connection.exec ute("tablename" ,,adcmdtable).f ields.count

--
Roy-Vidar
Sep 29 '06 #2
Hi
Thanks for the help, I was thrown a bit as when I used
redim strTitles(rs.fi elds.count-1) the value gave me the total rows
instead of total columns
but when I took out the rs.fields.count of the array re dimension the
numbers rec'ed
Strange one
Regards
KC

RoyVidar wrote:
"KayC" <ka******@yahoo .co.ukwrote in message
<11************ **********@b28g 2000cwb.googleg roups.com>:
Hi
I use Access2000 and am trying to count the number of columns in a
table in VBA
Does anyone know if this possible?
thanks
KC

If you have opened a recordset based on the table, you can use

msgbox rs.fields.count

Without, you can do something like this with a DAO tabledefs object

msgbox currentdb.table defs("tablename ").fields.c ount

Or with ADO, you could do

msgbox _
currentproject. connection.exec ute("tablename" ,,adcmdtable).f ields.count

--
Roy-Vidar
Sep 29 '06 #3

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

Similar topics

36
4636
by: toedipper | last post by:
Hello, I am designing a table of vehicle types, nothing special, just a list of unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor etc etc For the table design I am proposing a single column table with a field name called vehicle_type and this will contain the vehicle type. Sot it will be
8
20340
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source Type = Value List. Row Source = "1; "Above"; 2; "Below"; 3; "Equal"". When I try to SELECT <field> FROM <table> in my C++ application through ADO, I...
0
1178
by: clivegisworkuk | last post by:
I am running this on a Pocket PC NOT on a PC. I want to select a row of data, then insert the row of data from tableA into tableB. Is this possible??? Any assistance would be appreciated as I have got stuck!!! Cheers Clive Private Sub Test_Click()
2
23901
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table but the table column names. I've seen other posts that suggest using the SQL command DESCRIBE but I can't get it to work for some reason. Other...
9
6781
by: PeteCresswell | last post by:
I've got something called "Reference Rates". The idea is that on a given day, we have various rates of return for various entities. e.g. Libor 3-month return, Libor 6-month return, US Treasury Bonds, the Prime rate, and so-forth. We associate a security with one of those rates. There are a set of rates for each calendar day, and the...
4
2730
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients,...
7
8693
by: hjohnson | last post by:
Within the access environment, I have a table that I'd like to -add a column -place the record number of each record into that column The autonumber is not working for me because I am importing a .txt file into access using a specification file. The table is created at this time. When these steps are performed by hand access prompts you...
14
6539
by: Mark | last post by:
I have a table with a field that uses a combobox to populate values. The Lookup tab within table design mode is the following: Display Control Combo Box Row Source Type Table/Query Row Source SELECT .LastName, .FirstName, .EmployeeNumber FROM ; Bound Column 3 Column Count 3...
0
2129
by: Clare CAVS | last post by:
I have a table with a lookup column referring to another table . tblRooms has two fields, (Autonumber), and . The column I want to display is the RoomName column. If I have Bound Column = 1, and Column Count = 2, Column Widths 0cm;3cm I get the display I want. However, if I change the Bound Column to 2, this changes the values displayed...
5
4922
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link:...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8215
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.