![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
=[start_date] And <=[end_date] |
#2
| |||
| |||
|
|
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") |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
Criteria form |
#5
| |||
| |||
|
|
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 tom7744.no.spam (AT) cox (DOT) net> wrote: Criteria form Yes. Create a form that has the data entry fields for the report. |
#6
| |||
| |||
|
|
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 tom7744.no.spam (AT) cox (DOT) net> wrote: 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 |
#7
| |||
| |||
|
|
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 <oil (AT) vinegar (DOT) com> wrote: 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 tom7744.no.spam (AT) cox (DOT) net> wrote: 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 |
#8
| |||
| |||
|
|
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 <sparks (AT) comcast (DOT) net> wrote: 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 <oil (AT) vinegar (DOT) com> wrote: 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 tom7744.no.spam (AT) cox (DOT) net> wrote: 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 |
#9
| |||
| |||
|
|
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 <sparks (AT) comcast (DOT) net> wrote: 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 <oil (AT) vinegar (DOT) com> wrote: 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 tom7744.no.spam (AT) cox (DOT) net> wrote: 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 |
#10
| |||
| |||
|
|
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 <oil (AT) vinegar (DOT) com> wrote: 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 <sparks (AT) comcast (DOT) net> wrote: 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 <oil (AT) vinegar (DOT) com> wrote: 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 tom7744.no.spam (AT) cox (DOT) net> wrote: 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |