473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

trying to look at dates

Right now I had to build a report that allowed the people to check for
gross outliers in their data input.
short I am looking at 2.5* std dev + -

anyway I used 2 dummy variables in the query the report is tied to.
start date and end date. This pops up an input box for these values
and they put in 11/01/08 and 11/31/08 and it runs the report showing
the outliers.
I watched and everyone is looking at month not date
Now I was thinking instead fof this in the query under recDATE
>=[start_date] And <=[end_date]
is there a way of just asking for a month and year and then comparing
the recDATE without day in it?

so one check for a new input of CKdate being 11/08

Later I might even do something first to ask month or range.

Oct 15 '08 #1
9 1822
sparks wrote:
Right now I had to build a report that allowed the people to check for
gross outliers in their data input.
short I am looking at 2.5* std dev + -

anyway I used 2 dummy variables in the query the report is tied to.
start date and end date. This pops up an input box for these values
and they put in 11/01/08 and 11/31/08 and it runs the report showing
the outliers.
I watched and everyone is looking at month not date
Now I was thinking instead fof this in the query under recDATE

>>=[start_date] And <=[end_date]


is there a way of just asking for a month and year and then comparing
the recDATE without day in it?

so one check for a new input of CKdate being 11/08

Later I might even do something first to ask month or range.
? format(date(),"yyyymm")
200810
? datepart("m",date())
10
? datepart("d",date())
15
? datepart("yyyy",date())
2008

Using Format or DatePart you should be able to create a criteria string
to pass when opening the report. Notice that Format returns a string
value and DatePart a numeric value. You could also use Year(), Month(),
Day() as well.

Oct 15 '08 #2
On Wed, 15 Oct 2008 12:56:15 GMT, sparks <sp****@comcast.netwrote:

I would suggest you create a Criteria form, where the user can enter a
Month and Year. You then turn that into a date range which you feed to
the report.

-Tom.
Microsoft Access MVP

>Right now I had to build a report that allowed the people to check for
gross outliers in their data input.
short I am looking at 2.5* std dev + -

anyway I used 2 dummy variables in the query the report is tied to.
start date and end date. This pops up an input box for these values
and they put in 11/01/08 and 11/31/08 and it runs the report showing
the outliers.
I watched and everyone is looking at month not date
Now I was thinking instead fof this in the query under recDATE
>>=[start_date] And <=[end_date]

is there a way of just asking for a month and year and then comparing
the recDATE without day in it?

so one check for a new input of CKdate being 11/08

Later I might even do something first to ask month or range.
Oct 15 '08 #3
Ok the datepart worked fine on the month entry.

When you say criteria form do you mean a form with something like this

start_date text box
end_date text box

button to open the report.
if you click on the button it will pop up a start_date box for input
then and end_date box for input.

can the start_date and end_date be passed to the report instead

DoCmd.OpenReport stDocName, acPreview it has a where and an open args
that can be passed to the report.

start_date=text1.value
end_date=text2.value
something like that?

have to try that it sounds interesting

On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
<to*************@cox.netwrote:
>Criteria form
Oct 15 '08 #4
sparks wrote:
Ok the datepart worked fine on the month entry.

When you say criteria form do you mean a form with something like this

start_date text box
end_date text box

button to open the report.
if you click on the button it will pop up a start_date box for input
then and end_date box for input.

can the start_date and end_date be passed to the report instead

DoCmd.OpenReport stDocName, acPreview it has a where and an open args
that can be passed to the report.

start_date=text1.value
end_date=text2.value
something like that?

have to try that it sounds interesting

On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
<to*************@cox.netwrote:

>>Criteria form

Yes. Create a form that has the data entry fields for the report.
Docmd.Openform "ReportNameCriteria"

You'd have text boxes for your filter on the form and a command button
to open the report, another to exit. For the Command button to run/open
the report you'd have some code similar to the aircode below.
Dim strF As String
If Not IsNull(Me.TextBoxName1) then
strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
Endif
If Not IsNull(Me.TextBoxName2) then
strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
Endif
....any other additional filtering that is required

'now remove the " And " at the end of the filter string
If strF "" Then strF = Left(strF,Len(strF)-5)

Docmd.OpenReport "ReportName",,,strF

You can do the same/similar thing to open a Form

Things to remember.
String require quotes
Dates require #
Numbers nothing

"StringFld = '" & TextBoxVal & "'"
"DateFld = #" & TextBoxVal & "#"
"NumberFld = " & TextBoxVal

Oct 15 '08 #5
OK after modifying everything I can think of.
I have sent these 3 strings to the report

DoCmd.OpenReport stDocName, acPreview, , , strF

debug.print strF

Start_date = #11/1/2006# And End_Date = #11/30/2006#
Start_date = 11/1/2006 And End_Date = 11/30/2006
Start_date = "11/1/2006" And End_Date = "11/30/2006"
every one returns type mismatch

I guess I don't understand what is up

On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oi*@vinegar.comwrote:
>sparks wrote:
>Ok the datepart worked fine on the month entry.

When you say criteria form do you mean a form with something like this

start_date text box
end_date text box

button to open the report.
if you click on the button it will pop up a start_date box for input
then and end_date box for input.

can the start_date and end_date be passed to the report instead

DoCmd.OpenReport stDocName, acPreview it has a where and an open args
that can be passed to the report.

start_date=text1.value
end_date=text2.value
something like that?

have to try that it sounds interesting

On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
<to*************@cox.netwrote:

>>>Criteria form

Yes. Create a form that has the data entry fields for the report.
Docmd.Openform "ReportNameCriteria"

You'd have text boxes for your filter on the form and a command button
to open the report, another to exit. For the Command button to run/open
the report you'd have some code similar to the aircode below.
Dim strF As String
If Not IsNull(Me.TextBoxName1) then
strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
Endif
If Not IsNull(Me.TextBoxName2) then
strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
Endif
....any other additional filtering that is required

'now remove the " And " at the end of the filter string
If strF "" Then strF = Left(strF,Len(strF)-5)

Docmd.OpenReport "ReportName",,,strF

You can do the same/similar thing to open a Form

Things to remember.
String require quotes
Dates require #
Numbers nothing

"StringFld = '" & TextBoxVal & "'"
"DateFld = #" & TextBoxVal & "#"
"NumberFld = " & TextBoxVal
Oct 15 '08 #6

now I see what is up..
teach me to cut and paste
DoCmd.OpenReport stDocName, acPreview, , , ,strF
needed another ,

now it passes any of them..opens the report and request input of
Start_Date and End_Date

I am wondering that since these are dummy variables in the query that
the report is tied to that it can not pass them to the report to then
pass them to the query.

On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sp****@comcast.netwrote:
>OK after modifying everything I can think of.
I have sent these 3 strings to the report

DoCmd.OpenReport stDocName, acPreview, , , strF

debug.print strF

Start_date = #11/1/2006# And End_Date = #11/30/2006#
Start_date = 11/1/2006 And End_Date = 11/30/2006
Start_date = "11/1/2006" And End_Date = "11/30/2006"
every one returns type mismatch

I guess I don't understand what is up

On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oi*@vinegar.comwrote:
>>sparks wrote:
>>Ok the datepart worked fine on the month entry.

When you say criteria form do you mean a form with something like this

start_date text box
end_date text box

button to open the report.
if you click on the button it will pop up a start_date box for input
then and end_date box for input.

can the start_date and end_date be passed to the report instead

DoCmd.OpenReport stDocName, acPreview it has a where and an open args
that can be passed to the report.

start_date=text1.value
end_date=text2.value
something like that?

have to try that it sounds interesting

On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
<to*************@cox.netwrote:
Criteria form

Yes. Create a form that has the data entry fields for the report.
Docmd.Openform "ReportNameCriteria"

You'd have text boxes for your filter on the form and a command button
to open the report, another to exit. For the Command button to run/open
the report you'd have some code similar to the aircode below.
Dim strF As String
If Not IsNull(Me.TextBoxName1) then
strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
Endif
If Not IsNull(Me.TextBoxName2) then
strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
Endif
....any other additional filtering that is required

'now remove the " And " at the end of the filter string
If strF "" Then strF = Left(strF,Len(strF)-5)

Docmd.OpenReport "ReportName",,,strF

You can do the same/similar thing to open a Form

Things to remember.
String require quotes
Dates require #
Numbers nothing

"StringFld = '" & TextBoxVal & "'"
"DateFld = #" & TextBoxVal & "#"
"NumberFld = " & TextBoxVal
Oct 15 '08 #7
sparks wrote:
now I see what is up..
teach me to cut and paste
DoCmd.OpenReport stDocName, acPreview, , , ,strF
needed another ,

now it passes any of them..opens the report and request input of
Start_Date and End_Date

I am wondering that since these are dummy variables in the query that
the report is tied to that it can not pass them to the report to then
pass them to the query.
Actually, you have two extra commas.

DOcmd.OpenReport "RptName","view","filter","where condition","arguments"

If you want to preview first...
DoCmd.OpenReport stDocName, acPreview,,strF
would work better.

BTW, use the # around the dates if the table fields are type datetime.

I've never used the "filter" argument in the command line, only the
"where condition"

You can pass an argument to the report that is accessable via the
OpenArgs property. For example...
Docmd.OpenReport "rptname",,,,Me.Name
and in the OnOpen event (or any report event) enter something like
msgbox "the calling form name is " & Me.OpenArgs
>
On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sp****@comcast.netwrote:

>>OK after modifying everything I can think of.
I have sent these 3 strings to the report

DoCmd.OpenReport stDocName, acPreview, , , strF

debug.print strF

Start_date = #11/1/2006# And End_Date = #11/30/2006#
Start_date = 11/1/2006 And End_Date = 11/30/2006
Start_date = "11/1/2006" And End_Date = "11/30/2006"
every one returns type mismatch

I guess I don't understand what is up

On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oi*@vinegar.comwrote:

>>>sparks wrote:
Ok the datepart worked fine on the month entry.

When you say criteria form do you mean a form with something like this

start_date text box
end_date text box

button to open the report.
if you click on the button it will pop up a start_date box for input
then and end_date box for input.

can the start_date and end_date be passed to the report instead

DoCmd.OpenReport stDocName, acPreview it has a where and an open args
that can be passed to the report.

start_date=text1.value
end_date=text2.value
something like that?

have to try that it sounds interesting

On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
<to*************@cox.netwrote:

>Criteria form
Yes. Create a form that has the data entry fields for the report.
Docmd.Openform "ReportNameCriteria"

You'd have text boxes for your filter on the form and a command button
to open the report, another to exit. For the Command button to run/open
the report you'd have some code similar to the aircode below.
Dim strF As String
If Not IsNull(Me.TextBoxName1) then
strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
Endif
If Not IsNull(Me.TextBoxName2) then
strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
Endif
....any other additional filtering that is required

'now remove the " And " at the end of the filter string
If strF "" Then strF = Left(strF,Len(strF)-5)

Docmd.OpenReport "ReportName",,,strF

You can do the same/similar thing to open a Form

Things to remember.
String require quotes
Dates require #
Numbers nothing

"StringFld = '" & TextBoxVal & "'"
"DateFld = #" & TextBoxVal & "#"
"NumberFld = " & TextBoxVal

Oct 15 '08 #8
I tried passing the filter and even passed filteron= true on the
openargs...
after removing the criteria of >=[start_date] And <=[end_date] in the
query.
I decied to try it and see what happened so then I tried this

strF = "[date1]>= " & "#" & Me.text1 & "#" & " And [date1]<= " & "#" &
Me.text2 & "#"

DoCmd.OpenReport stDocName, acPreview
Reports![RangeCheck].Filter = strF
Reports![RangeCheck].FilterOn = True

and it worked.
this does not make much since to me but getting it to work was at
least a start

On Wed, 15 Oct 2008 14:42:21 -0700, Salad <oi*@vinegar.comwrote:
>sparks wrote:
>now I see what is up..
teach me to cut and paste
DoCmd.OpenReport stDocName, acPreview, , , ,strF
needed another ,

now it passes any of them..opens the report and request input of
Start_Date and End_Date

I am wondering that since these are dummy variables in the query that
the report is tied to that it can not pass them to the report to then
pass them to the query.

Actually, you have two extra commas.

DOcmd.OpenReport "RptName","view","filter","where condition","arguments"

If you want to preview first...
DoCmd.OpenReport stDocName, acPreview,,strF
would work better.

BTW, use the # around the dates if the table fields are type datetime.

I've never used the "filter" argument in the command line, only the
"where condition"

You can pass an argument to the report that is accessable via the
OpenArgs property. For example...
Docmd.OpenReport "rptname",,,,Me.Name
and in the OnOpen event (or any report event) enter something like
msgbox "the calling form name is " & Me.OpenArgs
>>
On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sp****@comcast.netwrote:

>>>OK after modifying everything I can think of.
I have sent these 3 strings to the report

DoCmd.OpenReport stDocName, acPreview, , , strF

debug.print strF

Start_date = #11/1/2006# And End_Date = #11/30/2006#
Start_date = 11/1/2006 And End_Date = 11/30/2006
Start_date = "11/1/2006" And End_Date = "11/30/2006"
every one returns type mismatch

I guess I don't understand what is up

On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oi*@vinegar.comwrote:
sparks wrote:
>Ok the datepart worked fine on the month entry.
>
>When you say criteria form do you mean a form with something like this
>
>start_date text box
>end_date text box
>
>button to open the report.
>if you click on the button it will pop up a start_date box for input
>then and end_date box for input.
>
>can the start_date and end_date be passed to the report instead
>
>DoCmd.OpenReport stDocName, acPreview it has a where and an open args
>that can be passed to the report.
>
>start_date=text1.value
>end_date=text2.value
>something like that?
>
>have to try that it sounds interesting
>
>
>
>
>
>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
><to*************@cox.netwrote:
>
>
>
>>Criteria form
>
>
Yes. Create a form that has the data entry fields for the report.
Docmd.Openform "ReportNameCriteria"

You'd have text boxes for your filter on the form and a command button
to open the report, another to exit. For the Command button to run/open
the report you'd have some code similar to the aircode below.
Dim strF As String
If Not IsNull(Me.TextBoxName1) then
strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
Endif
If Not IsNull(Me.TextBoxName2) then
strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
Endif
....any other additional filtering that is required

'now remove the " And " at the end of the filter string
If strF "" Then strF = Left(strF,Len(strF)-5)

Docmd.OpenReport "ReportName",,,strF

You can do the same/similar thing to open a Form

Things to remember.
String require quotes
Dates require #
Numbers nothing

"StringFld = '" & TextBoxVal & "'"
"DateFld = #" & TextBoxVal & "#"
"NumberFld = " & TextBoxVal

Oct 16 '08 #9
sparks wrote:
I tried passing the filter and even passed filteron= true on the
openargs...
after removing the criteria of >=[start_date] And <=[end_date] in the
query.
I decied to try it and see what happened so then I tried this

strF = "[date1]>= " & "#" & Me.text1 & "#" & " And [date1]<= " & "#" &
Me.text2 & "#"

DoCmd.OpenReport stDocName, acPreview
Reports![RangeCheck].Filter = strF
Reports![RangeCheck].FilterOn = True

and it worked.
this does not make much since to me but getting it to work was at
least a start
You can filter the reports recordsource or you can pass the filter to
the report

I prefer doing something like this
Select * from orders
as the recordsource for the report and then open the report like
Docmd.OpenReport "RptName",acViewPreview,,"OrderNo = 1"

Let's say the form to call the report is CallRpt. In the query you
could have something like
Select * From Orders Where OrderNo = " & Forms!CallRpt!OrderNo
and it would search/filter onthe value of the textbox OrderNo in the form.

Since you post partial info I can only throw some mud and hope it sticks.

What you should try is entering the Docmd.Report and then step thru the
options when calling a report as you will be prompted for each argument.

>
On Wed, 15 Oct 2008 14:42:21 -0700, Salad <oi*@vinegar.comwrote:

>>sparks wrote:

>>>now I see what is up..
teach me to cut and paste
DoCmd.OpenReport stDocName, acPreview, , , ,strF
needed another ,

now it passes any of them..opens the report and request input of
Start_Date and End_Date

I am wondering that since these are dummy variables in the query that
the report is tied to that it can not pass them to the report to then
pass them to the query.

Actually, you have two extra commas.

DOcmd.OpenReport "RptName","view","filter","where condition","arguments"

If you want to preview first...
DoCmd.OpenReport stDocName, acPreview,,strF
would work better.

BTW, use the # around the dates if the table fields are type datetime.

I've never used the "filter" argument in the command line, only the
"where condition"

You can pass an argument to the report that is accessable via the
OpenArgs property. For example...
Docmd.OpenReport "rptname",,,,Me.Name
and in the OnOpen event (or any report event) enter something like
msgbox "the calling form name is " & Me.OpenArgs

>>>

On Wed, 15 Oct 2008 19:47:25 GMT, sparks <sp****@comcast.netwrote:

OK after modifying everything I can think of.
I have sent these 3 strings to the report

DoCmd.OpenReport stDocName, acPreview, , , strF

debug.print strF

Start_date = #11/1/2006# And End_Date = #11/30/2006#
Start_date = 11/1/2006 And End_Date = 11/30/2006
Start_date = "11/1/2006" And End_Date = "11/30/2006"
every one returns type mismatch

I guess I don't understand what is up

On Wed, 15 Oct 2008 09:17:07 -0700, Salad <oi*@vinegar.comwrote:

>sparks wrote:
>
>
>
>>Ok the datepart worked fine on the month entry.
>>
>>When you say criteria form do you mean a form with something like this
>>
>>start_date text box
>>end_date text box
>>
>>button to open the report.
>>if you click on the button it will pop up a start_date box for input
>>then and end_date box for input.
>>
>>can the start_date and end_date be passed to the report instead
>>
>>DoCmd.OpenReport stDocName, acPreview it has a where and an open args
>>that can be passed to the report.
>>
>>start_date=text1.value
>>end_date=text2.value
>>something like that?
>>
>>have to try that it sounds interesting
>>
>>
>>
>>
>>
>>On Wed, 15 Oct 2008 06:57:01 -0700, Tom van Stiphout
>><to*************@cox.netwrote:
>>
>>
>>
>>
>>>Criteria form
>>
>>
>Yes. Create a form that has the data entry fields for the report.
> Docmd.Openform "ReportNameCriteria"
>
>You'd have text boxes for your filter on the form and a command button
>to open the report, another to exit. For the Command button to run/open
>the report you'd have some code similar to the aircode below.
> Dim strF As String
> If Not IsNull(Me.TextBoxName1) then
> strF = "FldNameToFilter1 = " & Me.TextBoxName1 & " And "
> Endif
> If Not IsNull(Me.TextBoxName2) then
> strF = strF & _
"FieldNameToFilter2 = " & Me.TextBoxName2 & " And "
> Endif
> ....any other additional filtering that is required
>
> 'now remove the " And " at the end of the filter string
> If strF "" Then strF = Left(strF,Len(strF)-5)
>
> Docmd.OpenReport "ReportName",,,strF
>
>You can do the same/similar thing to open a Form
>
>Things to remember.
> String require quotes
> Dates require #
> Numbers nothing
>
> "StringFld = '" & TextBoxVal & "'"
> "DateFld = #" & TextBoxVal & "#"
> "NumberFld = " & TextBoxVal

Oct 16 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
16
by: Atley | last post by:
I am trying to get a overall difference on two dates, I can get the difference in Years, Months, Weeks, Days, Hours, Minutes, Seconds, no problems... What I cannot seem to figure out is how to...
6
by: Robin Tucker | last post by:
Hi, I have two Date objects. The debugger shows their values as: #2/10/2005 1:17:05 PM# and #2/10/2005 1:17:05 PM#
1
by: pitfour.ferguson | last post by:
My dbase has the start date and end date of each visit. How can I ask Access to list the day of the week of the start (easy), end (easy) and, more importantly, the dates of the visit itself - ie...
8
by: Remington | last post by:
I am using windows 2000pro with access 2000. I am trying to make a database for our HR department, that would allow our HR Director to type in an employee's ID number into a form and then select...
4
by: JHNielson | last post by:
I have a query that I'm trying to update with a dlookup with multiple criteria This is the string: EVNT_DT: DLookUp("","","( .EVNT_QTR=.) & (.=.)") When i run it it says it can't find the...
5
by: robinsiebler | last post by:
I have a data structure that looks like this: # dates = {'2007': {'25': {'06/23/07': {'aerosmith': , # 'Metallica': }, # 'last_song': }}}...
0
by: daverskully | last post by:
I REALLY REALLY appreciate any help that anyone can offer. I have a table called Data with the following fields: 1) ID 2) ReportDate 3) Department 4) DepartmentNumber 5) AccountExecutive...
1
maxx233
by: maxx233 | last post by:
I need to look at/average some data from every third tuesday of each month during a specific time of day, over the course of the last 2 years. Can anyone think of ways, or recommend something to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.