Fields by date

  • Thread starter Thread starter Jazz57
  • Start date Start date
J

Jazz57

Good evening

i have a query where i identify 4 fields.

one of them is a date( 25-11-2007)

i want to retrieve the date in my query that matchs the date with today
(03-12-2007) dd-mm-yyyy.

This is a subject that i allways have doubts about it.

As allways i would apreciate very much any help.

Thanks a lot
 
Do you want to return the record with the date in it or are you just checking
to see if the date is in the table?
 
Hi -
If you're always intending to retrieve the current date's records, just
place Date() in the criteria cell of the query's date field.

Bob
 
Thanks for your reply:
As matter fact, that query is to populate a listbox with the date that i added to my table with the date equal to this day.

Maybe i am doing something wrong with the format (Short Date) . It might
have some problems with the hour and the date.

I really don't know

As default, this field has the Date() value as mentioned by another colegue
in this comunity.

So, i have to test which records were added today, then, after update the
records , populate my list box with the data equal to today's date.

Thanks again for your help and support.


--
Adriano Santos



"Klatuu" escreveu:
 
I'm not exactly clear on what your problem is, but I had a problem with UK
format dates in VBA.

You have to be very careful with UK format dates in VBA. It will only work
with USA (mm/dd/yyyy) format, regardless of system settings.

I had the strange situation where my functions would only work on dates (in
dd/mm/yyyy format) where the day value was larger than twelve.

I found out this is because VBA only likes to work with the USA format. If
you have UK sys settings and work with UK date formats, VBA TRIES to convert
the date to USA format before it can do an operation on it, it then tries to
convert it back to sys settings after it's finnished. If both the day and
month value are below 12, it can't tell which one is which and will usually
get it wrong. The fact this happens without the user's knowledge makes it
hard to detect, it took me ages anyway! And it's what makes me think you may
have a similar problem.

To get around it, at the beginning of your code, use Format( dateVar,
"mm/dd/yyyy" ) to convert it to USA format before you ask VBA to do anything
with it.

It should convert it back to sys settings when it's finished.

Hope that helps. If not it may be useful to someone else as I spent ages
looking for the answer.
 

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