First timer question here: In a customer data table, for each customer I have a field that includes dates in a single field. Example:
Name Dates
Steve 87,91,01,05,11, 12
Bob 99, 03
Ann 01,05,06
In the criteria field of a query, I would like to be able to determine who has at least three dates in the field. Any advice?
7 1396 jimatqsi 1,276
Recognized Expert Top Contributor
cdutcher, when you say "dates" do you mean "years"? I don't see any dates in your example data. It is helpful if you say precisely what you mean, rather than some other thing.
If the data is consistently formatted, you might be able to select based on the length of the data in the columns. Three 2-digit numbers + 2 commas is at least 8 characters, so your query could include
Jim
Hi Seth,
Unfortunately, I'm a bit of a noob regarding Access/data, and am hoping there's another way to achieve this. I'll look into normalizing it during my slow-summer months.
I had read elsewhere that I might be able to count the commas, but my syntax is erroring:
Length[dates] - Length(Replace([dates], "," , " "))
Hi Jim. My apologies, yes years (two digit years). The fields contain varying numbers of years, but there may be a way to calculate based upon the commas (eg, three or more years will include 2 or more commas).
jimatqsi 1,276
Recognized Expert Top Contributor
So the where clause I suggested should work just fine for you.
Light bulb above my head just went on. Thanks so much!
zmbd 5,501
Recognized Expert Moderator Expert
As an alternative (just incase spaces mess things up)
[Dates] = "87,91,01,05,11 ,12"
Find the position of the last comma
You basically have groups of three plus one group, so find the groups of three and add one, find out where the last comma is and then return the wholenumber of groups: ((instrrev("87, 91,01,05,11,12" ,","))\3)+1
NOTE: use "\" NOT "/" where MOD() returns the remainder "\" returns the resultant.
Yes, replace "87,91,..." with Bob's [Dates] and it will return 2, etc...
I'll leave it to OP to figure out the actual formula for the calculated field.
(^_^)
-It is best practice when naming fields, tables, and files to avoid the use of anything other than alphanumeric characters and the underscore (spaces although allowed are problematic from a programing point of view and best avoided) and it is VERY importaint to avoid all reserved words and tokens: Access 2007 reserved words and symbols AllenBrowne- Problem names and reserved words in Access
Also, I've reset the best answer to the post with the actual text of the clause (^_^)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jen F. |
last post by:
I have inherited a medical database in which there are multiple values
stored in a single field (ie. "Current Conditions" field might contain
1-20 different conditions, separated by comma (ie. "Heart
Disease,Hyper Tyroid,Cancer" etc.
I would like to search via combo box for any one or more than one
value in this field, ie-what patients have Heart Disease or Cancer by
selecting these disorders off the combo box list.
Any help would be...
|
by: Alicia |
last post by:
Hi, I have a simple question. I wanted to count a Column containing
Dates and the word "Empty".
This is what I am trying to do.
Closed Dates
------------
4/2/2004
4/7/2004
4/9/2004
|
by: Michael Curtis |
last post by:
This is kicking my @#$%. I have been asked to do a performance report
for our vendors. I need to compare and count dates.
1. Is called which is in a table named JOB DATES
2. Is called which is in a table called SHIP LOGS
I need >,<, and = to the ship date.
PLEASE HELP
|
by: Bjorn Sagbakken |
last post by:
What is the best way to read single field values from a dataset? The dataset
is populated with a customer record, showing well in a gridview. But I also
want to read the single field values, like adress, phone, and so on.
Bjorn
|
by: nathanwb |
last post by:
I have a small app that allows users to send messages back and forth to each other. I have a place that shows there messages and they can click on a message to read. I have a field in the table called "isread" this defaults to 0 when someone enters a new field and its directed to another user. This is a way that I can show the new message is new and unread.
What I would like to do is when a user clicks on one of his/her messages it would...
| |
by: GRUNT |
last post by:
As a beginer,Im trying to COUNT values in a single field where they meet the critria below., Then SUM then altogether.
Coursename,enddate1 and enddate2 are Request.QueryStrings form an .ASP web page which gnerates the query
The field is wish to SUM is "SERVICELEVEL"
I wish to COUNT the following
addressbook.ServiceLevel='Officer' +
addressbook.ServiceLevel='Senior Ranks' +
addressbook.ServiceLevel='Junior Ranks' = x
|
by: Jerry Maiapu |
last post by:
Hi there please can someone tell me how to create a query that will group a particular field and count the records in that field and return itsrecord with the maximum count..
The fields are in a single table.
For example if there were empleename,emptitle,and branch fields in a table and if there were many branches in a department, how can I create a query to return the branch with the highest no of employees.
Thanks
|
by: stormtrupr |
last post by:
I have a Table(PA Phrases) consisting of phrases to be used in a purchase agreement, but not all phrases apply for every purchase agreement. I want to allow the sales rep to select the phrases desired from a form, and then have a VBA or access query take all the phrases and concatenate them into a single paragraph style string, and put that string into another field in another table or at least into a text box on the form. I need to know what...
|
by: Doicare |
last post by:
Hi all
I am facing a problem in storing an array of integers to an OLE object field in the database, the used code for this action is listed below:
Sub Import_data()
Dim oAccesss As New ADODB.Connection
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |