Research on Date in a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

In my table called billed date: I would like to see all bills =>90 days (and
<=90 days) from bill_date

I have tried the

<= DateAdd("d", 90, date())

It gives me a list of all the bills 90 days from the current date!

Could somebody give me a hand!

Many thanks!!
 
Hy Chris,

in fact I need to have both I would like to have a view of all bills < 90
days from bill_date (a field which I already have in my database). I realise
I have to make separate queries but if I already know how to make the first I
am sure I could go on with the second.

Well? Chris, I have a problem with the date(), is that not the current date?
I already have recorded bill_dates in my db.

Many thanks,
 
halima said:
Hello,

In my table called billed date: I would like to see all bills =>90 days (and
<=90 days) from bill_date

halima,

Requesting both <= 90 and >= 90 will return all records.

Or do you want two queries, instead of one?

I have tried the

<= DateAdd("d", 90, date())

It gives me a list of all the bills 90 days from the current date!

"DateAdd("d", 90, date())" returns "03/05/2006".

<= 03/05/2006 will return all the bills 90 days from the current
date.

The above expression fulfills one of the conditions above.
= DateAdd("d", 90, date()) will fulfill the other condition.


Sincerely,

Chris O.
 
Dear Chris,

I am really sorry to bother you but I think I am getting a little confused.

The database covers 10 years of billing

I would like to see a list of bills covering a bills + 90 days

e.g I have 10/05/1999 (bill_date) + 90 days

I dont want a list with the current date as a criterium but with my own bill
date as criterium!

Thank you so much for your help!!!
 
halima said:
Hy Chris,

in fact I need to have both I would like to have a view of all bills < 90
days from bill_date

halima,

Please understand that as far as I can tell, you already have it.

(a field which I already have in my database). I realise
I have to make separate queries but if I already know how to make the first I
am sure I could go on with the second.

Then, I am assuming the results were good?

Well? Chris, I have a problem with the date(), is that not the
current date?

Yes, date() is the current date (assuming that the computer's date
is set correctly).

I already have recorded bill_dates in my db.


I am also assuming that I am not understanding what the problem is.

You have your bill dates. You have the current date + 90. You have
an expression that returns all bill dates less than the current date
+ 90. By changning <= to >=, you get the reverse (that you also
said you wanted).

I apologize, but I cannot determine exactly what is going wrong.

In the original post, you said:
date!

You have a ! at the end of the sentence, which makes it seem like
you are stating that these results are an error.

But above that:


This statement states that you want exactly what you said you are
getting.

This is why I am not sure what the problem is.


Sincerely,

Chris O.

PS Although meant for an sqlserver newsgroup, the
following link is still applicable for MS Access:
http://www.aspfaq.com/etiquette.asp?id=5006, and
is excellent when it comes to detailing how to
provide the information that will best enable
others to answer your questions.
 
halima said:
Dear Chris,

I am really sorry to bother you but I think I am getting a little confused.

The database covers 10 years of billing

I would like to see a list of bills covering a bills + 90 days

e.g I have 10/05/1999 (bill_date) + 90 days

I dont want a list with the current date as a criterium but with my own bill
date as criterium!

Thank you so much for your help!!!

:

halima,

Oh! Now I understand (I think).

My apologies, but I invented the table name and column names.

SELECT B1.col1
,B1.col2
,and so on . . .
FROM Bills AS B1
WHERE B1.your_date_column
BETWEEN B1.bill_date AND DATEADD("d", 90, B1.bill_date)

If the above isn't quite what you want, a desription of your table
structures, sample data, and desired results would be helpful.

Although meant for an sqlserver newsgroup, the
following link is still applicable for MS Access:
http://www.aspfaq.com/etiquette.asp?id=5006, and
is excellent when it comes to detailing how to
provide the information that will best enable
others to answer your questions.


Sincerely,

Chris O.
 
Hy Chris,

It worked :-), thank you very much from now on I'll call you my cyberangel :-)
Many thanks!!

p.s: hope I will still here from you, have a nice day!!!

Halima
 

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

Back
Top