473,473 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to calculate the length of a fields value separated by comma & assign it to other

8 New Member
in Access I have a table called Leaves in which Jan, Feb, Mar....Dec and Jantotal, Febtotal, Martotal.......Dectotal are fields

now lets say field Jan contains some data like " 01,07,21,29,31 " etc which is the total leave taken in month January here the total is 5 now I need to calculate this automatically after entering it in the form and assign this value to Jantotal

how is that possible I tried to convert it to an array and assigned the length of array to Jantotal but its not working properly the variable I used is not changing from record to next record

please provide me a solution
Aug 1 '08 #1
3 1639
puppydogbuddy
1,923 Recognized Expert Top Contributor
try this:
Expand|Select|Wrap|Line Numbers
  1. Dim intCount As Integer
  2.  
  3. ' - use split function, placing each line into array as an item
  4. JanTotal = Split("Jan",",")
  5. intCount = Ubound(JanTotal)
Aug 1 '08 #2
missinglinq
3,532 Recognized Expert Specialist
Am I correct in that you simply want a count of the days entered, as you said, 5 for your example? If so a single line will also do it.

Expand|Select|Wrap|Line Numbers
  1. MonthTotal = Len([Month]) - Len(Replace([Month], ",", ""))+1
Welcome to Bytes!

Linq ;0)>
Aug 1 '08 #3
haridharmajan
8 New Member
Am I correct in that you simply want a count of the days entered, as you said, 5 for your example? If so a single line will also do it.

Expand|Select|Wrap|Line Numbers
  1. MonthTotal = Len([Month]) - Len(Replace([Month], ",", ""))+1
Welcome to Bytes!

Linq ;0)>
thanx its working fine
Aug 2 '08 #4

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

Similar topics

2
by: Madhusudan Singh | last post by:
python-gpib provides Gpib.py (see end of post) for Linux. I am trying to use the method called read. I usually use it without arguments (the default length being 512). However, I am trying to...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
5
by: Theresa Hancock via AccessMonster.com | last post by:
I have an Excel table I need to import into Access. The name is entered into one field "Name". I'd like to have two fields in Access, FirstName and LastName. How do I do this. -- Message posted...
6
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the...
1
by: Miguel Dias Moura | last post by:
Hello, What I know: To send a Value in the URL and filter the results in order to display only the database records which FIELD_A = Value. What I need to do: I have a page with an Input...
9
by: phillip.s.powell | last post by:
Ok, you have three tables. You're supposed to be able to not only sort (ORDER BY) according to a_name, no problem, but you must also have the ability to sort (ORDER BY) the relationship between...
3
by: starman7 | last post by:
I'm attempting a query that gathers product data for a particular product id. One of the items is designer(s) which can be more than one. The product table has comma separated id's of the...
2
by: martin77 | last post by:
Here is what I have for the code keep getting error on 'declare variables and assign address to object variables Dim strId As String, strPayment As String, curPayment As Currency ...
10
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
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
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,...
0
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...
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.