please help with a criteria

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

Guest

Can someone please let me know how do i write the criteria to show me
everything 3 months before from current date meaning if today is 4/3/06 i
would like to see everything from 1/3/06 to 1/3/05
and the 2nd one is 1 year before from current date so if its 4/3/06 i want
to see everything from 4/3/05 and earlier
they arein 2 different query
thank you
I'm loosing my mind trying to figures this out
 
Can someone please let me know how do i write the criteria to show me
everything 3 months before from current date meaning if today is 4/3/06 i
would like to see everything from 1/3/06 to 1/3/05
and the 2nd one is 1 year before from current date so if its 4/3/06 i want
to see everything from 4/3/05 and earlier
they arein 2 different query
thank you
I'm loosing my mind trying to figures this out

Split the date into parts - Day, Month, Year. Do your addition/subtraction
on those parts then recombine into a date.
 
how do i do that?? I'm trying to make this little databse program for myself
and all I'm using is the book but its really not helping
 
LearningByMyself said:
how do i do that?? I'm trying to make this little databse program for
myself
and all I'm using is the book but its really not helping

From the help file, this adds 1 to the month to figure out the days in a
month:-

Function DaysInMonth(dteInput As Date) As Integer
Dim intDays As Integer

' Add one month, subtract dates to find difference.
intDays = DateSerial(Year(dteInput), _
Month(dteInput) + 1, Day(dteInput)) _
- DateSerial(Year(dteInput), _
Month(dteInput), Day(dteInput))
DaysInMonth = intDays
Debug.Print intDays
End Function

'This will call the function as a test
Sub CallDaysInMonth()
Dim intDays As Integer
intDays = DaysInMonth(#4/1/1996#)
intDays = DaysInMonth("4-1-96")
intDays = DaysInMonth("April 1, 1996")
End Sub


BTW, there is a bug in the example given in the help file. The above works.
 

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


Back
Top