473,320 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Date difference expression in microsoft access

Expand|Select|Wrap|Line Numbers
  1. Expr1:DateDiff("yyyy" [Visit Date]-[DOB])
What am I doing wrong?? operand without an operator... what does this mean?
Jun 18 '14 #1

✓ answered by Stewart Ross

DateDiff takes three arguments: the type of difference it is to return, and the two dates it is to compare. You have these, but you are not separating the arguments with commas. There is also no need to subtract one date from the other - that defeats the purpose of using Datediff.

YearDiff: DateDiff("yyyy", [Visit Date], [DOB])

If the date difference in years returned is negative just swap the visit date and DOB arguments over.

-Stewart

1 1254
Stewart Ross
2,545 Expert Mod 2GB
DateDiff takes three arguments: the type of difference it is to return, and the two dates it is to compare. You have these, but you are not separating the arguments with commas. There is also no need to subtract one date from the other - that defeats the purpose of using Datediff.

YearDiff: DateDiff("yyyy", [Visit Date], [DOB])

If the date difference in years returned is negative just swap the visit date and DOB arguments over.

-Stewart
Jun 18 '14 #2

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

Similar topics

0
by: Ray | last post by:
Date problem. Using non American date formats with Microsoft Access and Visual Basic. I set my regional settings to English(Ireland) or English(United Kingdom) and my date appears in Access as...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
2
by: Gershon | last post by:
I have a simple table including First Name, Last Name, Start Date. I need to create a report listing First, Last and the number of days since Start Date. The First and Last names are easy. How do I...
7
by: Ben | last post by:
Hi, What is the synatx in C# for calculating date difference between 2 dates in terms of no. of days? Thanks, Ben
10
by: Marcin Zmyslowski | last post by:
Hello all! I have a database created in MS Access 2003 which works fine in Win2000. This database shows me the following message in WinXP: "The expression On Load you entered as the event...
1
by: rockysg | last post by:
I need to create a page which takes input from a field from MS Access Database which has one date and there is another field in the MS Access Database which has another date. I want to find the...
3
by: Salad | last post by:
I have Microsoft Office Professional 2003 and the computer I connect to also has A2003 retail. The others in that office use Access 2003 runtime. Q1) I wanted to see if they were up-to-date on...
3
by: shivasusan | last post by:
Hi! I am using for my project ASP and Microsoft Access. start date and end date -- In database (Microsoft Access) i set the datatype is Date/Time. It's display error. The error is below:...
2
by: shivasusan | last post by:
Hi! when i pass the data to my database MS-Access. i got error. Error Type: Microsoft JET Database Engine (0x80040E07) Data type mismatch in criteria expression....
6
Seth Schrock
by: Seth Schrock | last post by:
I'm getting an error when trying to open my database on a user's PC: Undefined Function 'Date' in Expression. From looking online, it looks like it is a reference issue. The problem is that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.