473,666 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Datediff in an update query

1 New Member
I was trying to use the datediff function in the Update query and I added the following on the upate to field
: Datediff("d", [SentDate],[Recievedate]

where Sentdate: is a date stored in a table called cycle_table
Receievedate: is a date stored in a table called cycle_table
and I want to find the datediff in days
but I do not get the output I am expecting.
Sep 9 '07 #1
1 4981
missinglinq
3,532 Recognized Expert Specialist
I think the you're trying to do something the Update Query wasn't really designed for, which is running a calculation! What you need is a standard query with a Calculated Field. You didn't give the name of the field that holds the desired rsults, so I'll call it DiffInDays.

Instead of an update query, do this:
Make a standard query with whatever you need in it.
In a blank field name type in:

Expand|Select|Wrap|Line Numbers
  1. DiffInDays: DateDiff("d",[SentDate],[RecieveDate])
Run the query. DiffInDays will now hold the info you want. Now, wherever you want this info to show (table, report) simply include this calculated field. If you base your form on this query the days will be calculated every time you open the form.

Note: I spelled your field as you had it in your post RecieveDate, which is misspelled. If this was a typo on your part in the post correct it so that both field in table and field in the datediff calculation are spelled the same way!

Good Luck and Welcome to TheScripts!

Linq ;0)>
Sep 9 '07 #2

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

Similar topics

19
7271
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below. Specifically, I have a problem with this portion in the WHERE clause: DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between CONVERT(smalldatetime,str(DATEPART(Month, @DateNow)+1) + '/' + str(DATEPART(Day, tblMyEventTableName.TaskDateTime)) + '/'...
1
7998
by: intl04 | last post by:
I'm trying to set up a query that will include a new field ('Days until completion') whose value is derived from the DateDiff function. I think I have the syntax correct but am not sure. Days until completion: DateDiff("d",,) is TODAY the appropriate syntax for today's date? Could the function/expression even be set up that way, or do I need to do something else to get 'days until completion'? (My Access manuals do not mention a TODAY...
4
2856
by: C White | last post by:
Hi I am having problems with running a query that does the following there are 5 fields in a table that the query is based on, the first four are simple enough and all that happens is that the fields need to match, for that I was able to do the following to get records out of the database (does that make sense?) In (SELECT FROM As Tmp GROUP BY
2
1937
by: Contro | last post by:
Hi there! I hope you can help me! I have the following code: SELECT COUNT(Applications.) AS TOTAL FROM Applications WHERE DateDiff('d',,Date()) <6 AND = "Certificate"; Which returns the number of applications received between todays date
1
2776
by: Shawn Yates | last post by:
I have query which shows when employees clock in (long time) and clock out(long time). To find the total hours worked in hours and minutes I have another field on my query with the following: Total: DateDiff("n",,)\60 & Format(DateDiff("n",,) Mod 60,"\:00") This works great. I then made a report simply showing all the info from the query. My problem now is trying to find the total of the total fields. I tried putting "=Sum()" in an...
3
2062
by: davidwelli | last post by:
Hello, All help is appreciated, I'm struggling with the following. Using Access 2003 (front end) connecting to Oracle 7 database (back end). I'm trying to create a query in access that will show how many instances of something happens. Within the query I am using a calculated filed called "registered".The syntax is Registered: DateDiff("w",,)
4
6104
by: KA NMC | last post by:
I know this is very simple...but the syntax is really screwing me up...Basically what I want to do is have this query check for orders that have been open two hours and more and does not have a quoted price...a small snippet of my query with out all my inner joins is: select customer.customer_id_string, ordr.order_no, ordr.order_date.... from cus... join on ...cus = ... where (customer.customer_id_string like '12345' and datediff(hour,...
2
3419
by: stephenmcnutt | last post by:
I'm trying to do something that should be trivial. I'm a teacher at an elementary school, and I'm setting up an ASP form page for teachers to vote each afternoon on which dismissal line behaved best. I've done this sort of thing before. For example, I've set up a form page teachers use each day to record lunch counts. The results are saved to a database on the website, and a second ASP page displays the result using this "custom query":...
2
8873
by: ankitmathur | last post by:
Hi Friends, I have been trying to use this query to get all records that will expire within the next 30 days from the current date. While I am getting records with the same query what is bothering is I'm also getting records for the days past by. Select AccountId, ExpiryDate, DATEDIFF(DAY,GETDATE(),ExpiryDate) as DaysLeft From Usr_Accounts WHERE Status='Active' AND DATEDIFF(DAY,GETDATE(),ExpiryDate) < 31
0
8444
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, 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...
0
8356
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,...
0
8781
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
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,...
1
6198
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2771
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
2
1775
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.