I have a normal table with customer information
I have a DoB field and I want to have an automatic calculation that will show
the age of the customer in another field next to it called Age
Could you please help me with this
Thanx all 10 47851
Age: (Now()-[Birth Date])/365.25
tkq wrote: I have a normal table with customer information
I have a DoB field and I want to have an automatic calculation that will show the age of the customer in another field next to it called Age
Could you please help me with this
Thanx all
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200604/1
I tried what you suggested but this error message comes up
"Invalid SQL syntax - cannont use multiple columns in a column-level CHECK
constraint."
Do you know how to overcome this
On Mon, 03 Apr 2006 13:05:31 GMT, tkq wrote: I have a normal table with customer information
I have a DoB field and I want to have an automatic calculation that will show the age of the customer in another field next to it called Age
Could you please help me with this
Thanx all
In a query:
Age: DateDiff("yyyy" , [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)
Directly as the control source of an unbound control:
=DateDiff("yyyy ",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format (Date(),
"mmdd"),1,0 )
You do know, I hope, that this Age computation should NOT be stored in
any table.
Just compute it and display it on a form or report, as needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
"tkq" <u20428@uwe> wrote in news:5e3a073204 b88@uwe: I tried what you suggested but this error message comes up
"Invalid SQL syntax - cannont use multiple columns in a column-level CHECK constraint."
Do you know how to overcome this
You are trying to store the data at the table level. You need to
enter the formula in any of a query, a form or a report. It makes
no sense to store it in the table because it will need to be
recalculated every time you open the table, or any query based on
that table.
So to overcome this, remove the field 'age' from the table and put
it wherever you use to display the age.
--
Bob Quintal
PA is y I've altered my email address.
tkq wrote: I have a normal table with customer information
I have a DoB field and I want to have an automatic calculation that will show the age of the customer in another field next to it called Age
Could you please help me with this
Thanx all
In a query:
SELECT Int(Format(Date (),"yyyy.mmdd" ) -
Format([BirthDate],"yyyy.mmdd" )) AS AgeNow FROM tblBirthdays;
Note that the double quotes above can be converted to single quotes
when a dynamic SQL string is being created.
As a Control Source:
=Int(Format(Dat e(),"yyyy.mmdd" ) - Format([BirthDate],"yyyy.mmdd" ))
Note that Null values for [BirthDate] aren't handled here. For your
example, replace AgeNow with Age and replace [BirthDate] with your DoB
field name. I have used a similar technique for calculating elapsed
months using "mm.dd" with the Format command as part of the
calculation.
James A. Fortune CD********@Fort uneJames.com
To extend this a little bit.
Can have a query some thing like
SELECT tblBirthdays.*, Int(Format(Date (),"yyyy.mmdd" ) -
Format([tblBirthdays.Bi rthDate],"yyyy.mmdd" )) AS AgeNow FROM
tblBirthdays
You will get everything in your table plus a calculated Age column.
-Saran
Saran wrote: To extend this a little bit.
Can have a query some thing like
Where in the query would I write this. That is the only thing i'm not sure of SELECT tblBirthdays.*, Int(Format(Date (),"yyyy.mmdd" ) - Format([tblBirthdays.Bi rthDate],"yyyy.mmdd" )) AS AgeNow FROM tblBirthdays
You will get everything in your table plus a calculated Age column.
-Saran
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200604/1
tkq via AccessMonster.c om wrote: Saran wrote:To extend this a little bit.
Can have a query some thing like
Where in the query would I write this. That is the only thing i'm not sure of
There's a SQL View for queries. Paste the text into the SQL View
window. I usually put a semicolon at the end of the SQL text.
James A. Fortune CD********@Fort uneJames.com CD********@Fort uneJames.com wrote: >To extend this a little bit. > >Can have a query some thing like
Where in the query would I write this. That is the only thing i'm not sure of
There's a SQL View for queries. Paste the text into the SQL View window. I usually put a semicolon at the end of the SQL text.
James A. Fortune CD********@For tuneJames.com
Thanks very much, I've got it to work now
Thanks to all who helped aswell
Much Appreciated
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200604/1 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
hey all..... alright, I am frusterated to the point of throwing my
machine out
the window (this board went down, trying to find stuff on google, this
has been
a nightmare) so I hope you guys can help me with a solution. This is
what I am
trying to do:
Pretty much, there are two dates in my database, a start date, and an
end
|
by: Heath |
last post by:
I have serious Access problems so please be gentle.
I have one table that stores the quantities and
net sales for thousands of Products.
I have another table that has fixed costs values
on a country level.
I need to apply a percentage (based on net sales) of
the fixed costs across the products.
|
by: JLM |
last post by:
I have a table that has fieldA, fieldB, fieldC. I want
fieldC=fieldA-fieldB. simple enough. the next record I want to be able to
do the same on the new value of fieldC.
I can do this with SAP ABAP/4, but have never done this using Access.
I'm sure this can be done, but not sure how to go about it.
thanks in advance,
jlm
|
by: Alex |
last post by:
Hi all,
In Microsoft Access 2000, how do I tell a query to count a null as zero? I'm
adding several columns of data, and many contain nulls, but that makes my
results be null as well. Is there any simple way to compensate for this? Maybe
at the SQL level?
I run into this often in MS SQL, but I generally use a DTS to create a temp
table and convert all null's to zero... but in this Access database, the data is
linked from a...
|
by: luscus |
last post by:
Thanks for all the responses on my first question. Unfortunately the
answers I was given were too complicated for my small brain , and
neophite condition to understand. So if you could talk down to me and
write in easier terms I would be very gratefull to all you access
wizards!
Here is my problem. I have a table with maybe 10 fields, It is used to
imput information taken over the phone to solve patient problems in our
Spanish...
| |
by: kuhni |
last post by:
Hi everybody!
After searching newsgroups for a couple of hours, I now try asking
directly (running the risk of asking again the same question). My
problem is to predict when the size of the database (1GB I expect) is
over 1GB by calculating the maximal number of data sets (tuple) added:
1. Is the following calculation for estimating the mdb file size in
Access 97 correct:
1 integer field = 4 Byte
|
by: Wired Hosting News |
last post by:
Lets say I have 10 products in 10 different stores and every week I get a
report from each store telling me how many items they have left for each of
the 10 products.
So each week I enter in 100 records with a store number, item number, on
hand qty, and date of report into my sales data table.
My tables primary is a combo of store# & Item number & Date
After 10 week of this I have 1000 record total with ten unique dates.
|
by: Wired Hosting News |
last post by:
I tried to be breif and give a scenario so as not to be overlooked because
it was soooo long. Let me give you real world.
I am a manufacturer of goods and produce 11 items that are distributed to
1800 stores of a national home improvement chain store. Every week I
electronicaly receive an excel spreadsheet "inventory report" with 19,800
rows or records, which I import into my tblSalesData table. The table now
has 10 weeks of data or...
|
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 10:00:00 AM 12:00:00 PM
120
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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...
| |