FILTER DATES

G

Guest

hi guys,

im sooo frustrated filtering my data based on dates...

anyone can help?

my code:

xDateFrom = Format(txtDateFrom, "mm/dd/yyyy hh:mm:ss")
Me.Filter = "InviteBidDate ='" & xDateFrom & "'"
Me.FilterOn = True

I tried other codes, like adding # or removing "".. i know that there are
parameters used in filtering specifically for numbers,text and date... but i
cant just remember?

please help me....


thank you..



amsuria
 
G

Guest

I GOT IT!

Me.Filter = "InviteBidDate = #" & Format(xDateFrom, "dd/mm/yyyy") & "#"

tnx peepz anyway....

ciao!

amsuria
 
S

Svetlana

If InviteBidDate is a field date data type then try this
Dim xDateFrom As Variant
xDateFrom = Format(Me!txtDateFrom, "yyyy/mm/dd")
Me.Filter="InviteBidDate =#" & xDateFrom & "#"
Me.FilterOn = True

Or

Dim xDateFrom As Variant
xDateFrom = Format(CDate(Me!txtDateFrom), "yyyy/mm/dd")
Me.Filter="InviteBidDate =#" & xDateFrom & "#"
Me.FilterOn = True
 
J

John Vinson

hi guys,

im sooo frustrated filtering my data based on dates...

anyone can help?

my code:

xDateFrom = Format(txtDateFrom, "mm/dd/yyyy hh:mm:ss")
Me.Filter = "InviteBidDate ='" & xDateFrom & "'"
Me.FilterOn = True

I tried other codes, like adding # or removing "".. i know that there are
parameters used in filtering specifically for numbers,text and date... but i
cant just remember?

If you want to filter the Form to show those records where the
InviteBidDate is equal to the date and time in txtDateFrom, accurate
to the second (i.e. if the bid came one second earlier or one second
later you don't want to see it), use # as delimiter:

Me.Filter = "InviteBidDate =#" & xDateFrom & "#"

My guess is that this will ordinarily show no records, and I have no
idea why you want to include the time at all; but I don't know your
business nor how the InviteBidDate is stored.

John W. Vinson[MVP]
 
D

Douglas J. Steele

You got it for today, but that will not work for the first 12 days of any
month.

Regardless of what your Regional Settings have set the Short Date format to,
Access is going to try and interpret the date as mm/dd/yyyy. If it can't
(such as today, when you'll have 22/11/2006), then it'll try other formats.
However, next month when you have 01/12/2006, it will definitely treat that
as January 12th, not December 1st.

You must format the date either to mm/dd/yyyy, or to a non-ambiguous format
such as yyyy-mm-dd or dd mmm yyyy.
 

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

Top