the variance in days

P

Pietro

Hi,
I've a query that contains the General date field "recieved",I want to
count the variance in days between the values of the recieved and time(),so
that i may get the result formatted hh:nn:ss
 
P

Pietro

Thank you Tom for your answer,but i did not get you,i tried the below code
but it does not work.

Tom Wickerath said:
Hi Pietro,

Check out the DateDiff function in Access, combining this with the Format
function to format the output to your liking.

DateDiff Syntax:

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

Pietro said:
Hi,
I've a query that contains the General date field "recieved",I want to
count the variance in days between the values of the recieved and time(),so
that i may get the result formatted hh:nn:ss
 
H

heydill

I am still confused. When I paste the DateDiff function in the box, it has
generic data for arguments. How do I replace those with the Field I am
trying to reference? I saw somewhere that my table fields ought to be in the
left box so I could just click on them, but they are not. What specifically
is the syntax for referring to a table field in expressions?

Thanks
 
T

Tom Wickerath

Does this example query help show how to use the DateDiff function? I have
not formatted it as Pietro originally requested (ie. hh:nn:ss). To try out
this query, search your hard drive for the sample file named Northwind.mdb.
Create a new query without selecting any tables. In query design view, change
to SQL View, by clicking on View | SQL View. You should see the word SELECT
highlighted. Backspace over this to delete it. Copy the SQL statement shown
below, and paste it into the SQL View. Then run the query:

SELECT CompanyName, RequiredDate, ShippedDate,
DateDiff("d",[Orders.ShippedDate],[Orders.RequiredDate])
AS [Days Shipped Before Required Date]
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;


You can then switch back to the more familiar design view, if you wish.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top