Dates in a form for filtering Report query

I have a form "Period" with two text boxes. One for startDate
and one for EndDate. I want to use that form to limit the query
for my Report by the dates. However, when I refer to the
Form it does not seem to understand it is a date? I use the following
statement in my query:

SELECT Opphold.CheckIn
FROM Opphold
WHERE (((Opphold.CheckIn)<=[Forms]![Perioder].[txtStartDate]));

I also tried to convert it to a date like the following:
CDate(<=[Forms]![Perioder].[txtStartDate]))) but that did not work?

What should I do in order to the query to read the condition or dates from
my forms?

(The only thing I CAN get to work is if I make a function in vba that return
the value or date from the form and refering to the function in my Report 
query:
Function startingDate(myStart as Date) as Date
    startingDate = Forms("Period").txtStartDate
End Function)

Appreciate your answer.
Regards
Jan T.



0
Jan
3/12/2010 9:23:44 PM
access 16762 articles. 3 followers. Follow

4 Replies
937 Views

Similar Articles

[PageSpeed] 5

On Fri, 12 Mar 2010 22:23:44 +0100, Jan T. wrote:

> I have a form "Period" with two text boxes. One for startDate
> and one for EndDate. I want to use that form to limit the query
> for my Report by the dates. However, when I refer to the
> Form it does not seem to understand it is a date? I use the following
> statement in my query:
> 
> SELECT Opphold.CheckIn
> FROM Opphold
> WHERE (((Opphold.CheckIn)<=[Forms]![Perioder].[txtStartDate]));
> 
> I also tried to convert it to a date like the following:
> CDate(<=[Forms]![Perioder].[txtStartDate]))) but that did not work?
> 
> What should I do in order to the query to read the condition or dates from
> my forms?
> 
> (The only thing I CAN get to work is if I make a function in vba that return
> the value or date from the form and refering to the function in my Report 
> query:
> Function startingDate(myStart as Date) as Date
>     startingDate = Forms("Period").txtStartDate
> End Function)
> 
> Appreciate your answer.
> Regards
> Jan T.

You seem to have a discrepancy in the name of the form.
1)  Your opening statement .... I have a form "Period"
2)  Your Where clause .... <=[Forms]![Perioder].[txtStartDate]))
3)  Your Function .... startingDate = Forms("Period").txtStartDate

Perioder is not the same as Period. If the name of the form is
actually "Period" the query will not be able to find the form nor the
date. 

The correct Where clause syntax to return records between 2 dates
should be:
WHERE Opphold.CheckIn Between [Forms]![Period]![txtStartDate] AND
[Forms]![Period]![txtEndDate];

I would also suggest you make sure the 2 controls in the form have
their format property set to a valid US (mm/dd/yyyy) or ISO
(yyyy-mm-dd) date format.
Also, make sure the form is open when the query is run.

-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
fredg
3/12/2010 11:16:38 PM

"fredg" <fgutkind@example.invalid> skrev i melding 
news:18pvflcsz7tja.tuqfegmjxlei.dlg@40tude.net...
> On Fri, 12 Mar 2010 22:23:44 +0100, Jan T. wrote:
>
>> I have a form "Period" with two text boxes. One for startDate
>> and one for EndDate. I want to use that form to limit the query
>> for my Report by the dates. However, when I refer to the
>> Form it does not seem to understand it is a date? I use the following
>> statement in my query:
>>
>> SELECT Opphold.CheckIn
>> FROM Opphold
>> WHERE (((Opphold.CheckIn)<=[Forms]![Perioder].[txtStartDate]));
>>
>> I also tried to convert it to a date like the following:
>> CDate(<=[Forms]![Perioder].[txtStartDate]))) but that did not work?
>>
>> What should I do in order to the query to read the condition or dates 
>> from
>> my forms?
>>
>> (The only thing I CAN get to work is if I make a function in vba that 
>> return
>> the value or date from the form and refering to the function in my Report
>> query:
>> Function startingDate(myStart as Date) as Date
>>     startingDate = Forms("Period").txtStartDate
>> End Function)
>>
>> Appreciate your answer.
>> Regards
>> Jan T.
>
> You seem to have a discrepancy in the name of the form.
> 1)  Your opening statement .... I have a form "Period"
> 2)  Your Where clause .... <=[Forms]![Perioder].[txtStartDate]))
> 3)  Your Function .... startingDate = Forms("Period").txtStartDate
>
> Perioder is not the same as Period. If the name of the form is
> actually "Period" the query will not be able to find the form nor the
> date.
>
> The correct Where clause syntax to return records between 2 dates
> should be:
> WHERE Opphold.CheckIn Between [Forms]![Period]![txtStartDate] AND
> [Forms]![Period]![txtEndDate];
>
> I would also suggest you make sure the 2 controls in the form have
> their format property set to a valid US (mm/dd/yyyy) or ISO
> (yyyy-mm-dd) date format.
> Also, make sure the form is open when the query is run.
>
> -- 
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Oobs Perioder was an writing error and now corrected. However, I still
can not understand that the form contains a date? I also tried different
formats like US m/d/yyyy or European dd.mm.yyyy but none of them
work. I am getting the parameter Input Box because I looks for a date?

Regards
Jan T.



0
Jan
3/13/2010 8:02:32 AM
Found out. It was because of a writing error it did not work. Did not see 
that. :)
Thanx for your help.  Jan T

"Jan T." <noreply> skrev i melding 
news:OcQJKOowKHA.4532@TK2MSFTNGP05.phx.gbl...
>
>
> "fredg" <fgutkind@example.invalid> skrev i melding 
> news:18pvflcsz7tja.tuqfegmjxlei.dlg@40tude.net...
>> On Fri, 12 Mar 2010 22:23:44 +0100, Jan T. wrote:
>>
>>> I have a form "Period" with two text boxes. One for startDate
>>> and one for EndDate. I want to use that form to limit the query
>>> for my Report by the dates. However, when I refer to the
>>> Form it does not seem to understand it is a date? I use the following
>>> statement in my query:
>>>
>>> SELECT Opphold.CheckIn
>>> FROM Opphold
>>> WHERE (((Opphold.CheckIn)<=[Forms]![Perioder].[txtStartDate]));
>>>
>>> I also tried to convert it to a date like the following:
>>> CDate(<=[Forms]![Perioder].[txtStartDate]))) but that did not work?
>>>
>>> What should I do in order to the query to read the condition or dates 
>>> from
>>> my forms?
>>>
>>> (The only thing I CAN get to work is if I make a function in vba that 
>>> return
>>> the value or date from the form and refering to the function in my 
>>> Report
>>> query:
>>> Function startingDate(myStart as Date) as Date
>>>     startingDate = Forms("Period").txtStartDate
>>> End Function)
>>>
>>> Appreciate your answer.
>>> Regards
>>> Jan T.
>>
>> You seem to have a discrepancy in the name of the form.
>> 1)  Your opening statement .... I have a form "Period"
>> 2)  Your Where clause .... <=[Forms]![Perioder].[txtStartDate]))
>> 3)  Your Function .... startingDate = Forms("Period").txtStartDate
>>
>> Perioder is not the same as Period. If the name of the form is
>> actually "Period" the query will not be able to find the form nor the
>> date.
>>
>> The correct Where clause syntax to return records between 2 dates
>> should be:
>> WHERE Opphold.CheckIn Between [Forms]![Period]![txtStartDate] AND
>> [Forms]![Period]![txtEndDate];
>>
>> I would also suggest you make sure the 2 controls in the form have
>> their format property set to a valid US (mm/dd/yyyy) or ISO
>> (yyyy-mm-dd) date format.
>> Also, make sure the form is open when the query is run.
>>
>> -- 
>> Fred
>> Please respond only to this newsgroup.
>> I do not reply to personal e-mail
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>
> Oobs Perioder was an writing error and now corrected. However, I still
> can not understand that the form contains a date? I also tried different
> formats like US m/d/yyyy or European dd.mm.yyyy but none of them
> work. I am getting the parameter Input Box because I looks for a date?
>
> Regards
> Jan T.
>
>
> 


0
Jan
3/13/2010 8:10:53 AM
"Jan T." <noreply> wrote in message 
news:euqOJpiwKHA.3536@TK2MSFTNGP06.phx.gbl...
>I have a form "Period" with two text boxes. One for startDate
> and one for EndDate. I want to use that form to limit the query
> for my Report by the dates. However, when I refer to the
> Form it does not seem to understand it is a date? I use the following
> statement in my query:
>
> SELECT Opphold.CheckIn
> FROM Opphold
> WHERE (((Opphold.CheckIn)<=[Forms]![Perioder].[txtStartDate]));
>
> I also tried to convert it to a date like the following:
> CDate(<=[Forms]![Perioder].[txtStartDate]))) but that did not work?
>
> What should I do in order to the query to read the condition or dates from
> my forms?
>
> (The only thing I CAN get to work is if I make a function in vba that 
> return
> the value or date from the form and refering to the function in my Report 
> query:
> Function startingDate(myStart as Date) as Date
>    startingDate = Forms("Period").txtStartDate
> End Function)
>
> Appreciate your answer.
> Regards
> Jan T.
>
>
> 

0
De
3/13/2010 5:27:58 PM
Reply:

Similar Artilces:

filter by date and action
I have a table with three columns: Name Date Action Fred Today this Fred Today this Fred Today that Wilma Today this I want to sort by name and by date, but only if 'this' was done more than once on the same day, and not if 'that' was done on the same day,They have to perform this more than once, and they cannot have performed that on the same day. If not in excel, mssql maybe? Thanks, Harry On Aug 18, 1:53=A0pm, Harry <hamac...@gmail.com> wrote: > I have a table with three co...

moving from one form to another
I want to be able to move from form 1 to form 2 and retain matching information in form 1 to form 2. So, how do I link the one or two matching information in both the forms? I think what you are asking is how to link forms? If so, in properties for the forms or subforms, go to the data tab and enter your master and child link property. It should create that for you. If the forms are not on the same form (a form and subform) you might have to create a form/subform to link them. If you want to be able to see the same information in each form without linking, you would need to put the inf...

Calculate Years/Months Between Dates and then Average
We are using the formula =DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym") to calculate the years and months from an employee hire date. Is there an easy way to average the years and months for a group of employees with the results of that formula? You could use: =AVERAGE(A1:A10*1) Array-entered, meaning press ctrl-shift-enter. But you could also just change your current formula to: =1*(DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym")) Then just use: =AVERAGE(A1:A10) which is *not* array-entered. ...

Unexpected feature when working with Reporting Services
Using a previous version of Internet Explorer (6.0.2800.1106CO) we generate a Report from an aspx page (using Reporting Services). Then the report was showed in a popup page. The Reporting Services can export a report to Excel, so we used to do this and an Excel sheet opened, and the previous page (the 'popup') kept open. Now we've upgraded the Explorer to the 6.0.2900.2180.xpsp_sp2_rtm.040803-2158CO version and when exporting the report to an excel, the popup closes... we don't know why... can anybody explain me how to resolve this? Thanks in advance. has IE enabled...

Transaction Date VS Business Date
Our accounting department needs/wants to have all RMS SO reporting by business date opposed to transaction date. Usually these are the same unless you have sales and batches that close after midnight. For our store I would like to set 3 a.m. as the business day closing time. So when I run any type of reports I would like to get the information for a business date (range) starting at 3 a.m. till 3 a.m. the next day. I guess I could accomplish this by subtracting 3 hours from all the transaction (date and) times but I would have to do this for every single report which would be a lot of ...

Post Dated Checks
I had to prepare some post dated checks and we did not have fiscal periods set up yet to match the dates of the checks. Currently the check batches are waiting to be posted. What is the best way to handle post dated checks? If I create new fiscal years to match these dates, I will end up having 4 Open years. Is this the only way to do it? You can manage post dated checks in Microsoft Dynamics GP with the Payment Document Management module available on the Feature Pack 1 DVD image. For more info, take a look at MVP Mohammad Daoud's post on the subject at: https://communit...

Remove "Date: Yesterday" or "Date: Monday" from Outlook Inbox?
Outlook mail inbox now has headers that tell you what day the the email was sent. I find this visually annoying. Each emailalready has the time and day it was sent. I don't need the daily titles in the midst of the list of emails. How do I make them go away? I think you are talking about OL 2003 & the Arrange in Groups setting. Change it in View, Arrange by, uncheck Show in Groups. "silky" wrote: > Outlook mail inbox now has headers that tell you what day the the email was > sent. I find this visually annoying. Each emailalready has the time and day >...

strange date format problem
Hi, I downloaded some data on excel using Bloomberg. One column has dates and the other has numbers. Dates appear as 01/01/1980 format which I want in Jan-80 format. I have changed the format cell properties but it still appears as 01/01/1980. I have to goto individual cell and press F2 <enter> so see the effect. Dont know why? I cant even copy paste format after that .... TIA/amag I am not sure, but is your workbook set to Auto-Recalculate? Try pushing <F9> to do a manual re-calculation, see if that changes the formats. If it does, go to Tools (on the menu bar), Options, Ca...

Query combobox unbound column
Does anyone know if it is possible to run an append query referencing a column in a combobox. In otherwords, my combobox is bound to column 0 - ID and column 1 is the name. I want to append it to another table as the name, not ID? Thanks in advance, Bonnie Typically you would create a hidden text box like: Name: txtTheName Control Source: =ComboBox.Column(n) Visible: No Then reference txtTheName in place of the unbound column. Duane Hookom MS Access MVP "Bon" <Bon@discussions.microsoft.com> wrote in message news:9904A3B7-4B55-4F4E-976B-55249B436D...

How to sort by name then date?
I would like to look through all the emails to a particular person. If I click on the "To" column I can see all the emails to a particular person (actually there is a problem with that which I will mention next) but they seem to be in random order. Is there a way to have them sorted by date? (i.e. by name first, then by date). Actually, sorting on the "To" column does not get all the emails sent to a given email address. Because Outlook uses the "display as" field. It will often give different "display as" names to the same email address. C...

Combo values from query based on form fields
I am setting the values for a combo box in a form(s) via a query that 'filters' the results with criteria based upon the values of other fields on the form. The combo is a field that is bound. However, this is giving all kinds of problems ranging from Access completely crashing to being asked for the parameter values of those criteria fields when closing the form. I have tried making the combo an unbound field and then setting the value of the bound field to that unbound field after update, but that still leads to the same issues. How can I do this? As example - I have a form w...

filter form by listbox selection
Access 2003 form called fGua has an unbound list box called lstComponent. When the user selects from the listbox how can I make the form filter by that selection Private Sub lstComponent_AfterUpdate() Select Case lstComponent.Value Case "CT" 'CT Me.Filter = "[Component] = [lstComponent].value " Me.FilterOn = True Me.Component.DefaultValue = """" & Me.lstComponent.Value & """" Case "ST" 'ST Me.Filter = "[Component] = [lstComponent].value &q...

Concatenate including a date so that the date appears as a date
When I try to join the contents of several cells, one of which is a date and time obtained from =now(), the date and time part appears as a number. How can I make it appear as a date and time? I have tried changing the cell formats - probably there is a combination that works but I haven't found it. I also tried copying the original date cell to another cell and changing the latter cell's format and concatenating using that latter cell, but still no success. Use the TEXT function. For example, =TEXT(NOW(),"mmmm d, yyyy") would give January 6, 2010 "dd...

LDAP query E2K3 for Address list
I want to create a address list and select from a certain OU all the Groups mentioned in that OU. in command promt I give the following command: dsquery group ou=name,ou=name,DC=domain,dc=nl the result is only the groups are displayed. Within ESM I want to enter the LDAP query for it. What should that be? Peter ...

if statement with dates #2
I would like to have a statement like: IF(a1>0,1/1/2004) with 1/1/2004 beint a date. EXCEL is interpreting 1/1/2004 as an arithmetic statement and giving me the result of the arithemtic. I could put in the numeric offste for the date and write IF(a1>0,37987), formatting the cell as a date, but this seems awkward. What else can I do? TIA, Sanford ...

Count Unique Cells, within a date range (dates stored in separate column).
Hello All: I am attempting to create a formula that will count the number of unique cells (alpha-numeric) in an entire column (no set length, so ex: "$B:$B"). This count will be based on a date range (Between 2 dates). The dates are stored in another column (Ex: "$A:$A"). The following is an example of the cells. Dates PO_Num 1/2/2010 A123456 1/3/2010 B453453 2/2/2010 A123456 3/4/2010 C2342F3K 4/3/2010 123456 I would like to know a formula that can count the number of different PO's based on a given date range. Please help me if you...

Automated task to present data in a graph form.
Hi, I am newbie to Excel area. I got a requirement where in I need to present the Excel sheet data with 3 columns in a graphical form. Everyday, the excel sheet is populated with the current data. This is automated from the backend. I want to know whether there is any possibility of a macro which draws a graph with the data present in the excel sheet. It should be an automated task. Thanks for the help in advance. -- luckyguy ------------------------------------------------------------------------ luckyguy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=285...

Counting Dates?
=COUNTIF(A1:A100,"<" & NOW()) This works good for specific cells. I have a similar question. How would I do the same thing given that: 1) You only have a starting date 2) Your only wanting to count work days (in this case 4 day/wk) up to NOW() Thank you for all your help. Aviator On Thu, 6 Jan 2005 12:53:03 -0800, "Aviator" <Aviator@discussions.microsoft.com> wrote: >=COUNTIF(A1:A100,"<" & NOW()) > >This works good for specific cells. I have a similar question. > >How would I do the same thing given that: >1) You only ha...

Tax Forms 4506T
Am looking for the form 4506T, this is something my Bank told me to fill out and could find it online. But no luck so far. Help Did you check at www.irs.gov? "supercheek" <supercheek@discussions.microsoft.com> wrote in message news:390FD3B6-0812-4688-98AB-8552172ECE3A@microsoft.com... : Am looking for the form 4506T, this is something my Bank told me to fill out : and could find it online. But no luck so far. : Help ...

An expression for dates from and to
I am trying to create an expression to select items from a date field falling from a certain date to a certain date. I am obviously missing something in my expression. The field name is DateComplete. How can I set up this expression to pull date from a certain date to a certain date? -- Ronnie Hi Ronnie, An example of the SQL would be: SELECT * FROM [TABLE NAME] WHERE DateComplete Between #1/1/2006# And #1/1/2007# ; On May 23, 3:52 pm, Ronnie <Ron...@discussions.microsoft.com> wrote: > I am trying to create an expression to select items from a date field falling > from a...

Returning only MAX(date) not all dates
I want to be able to list the most current date an item is checked out. As I was working through the query I used max as an aggregate function but I still can't get the simple result I want. I'd rather list the fields I have chosen and somehow select just the most current checkout date. Any help would be greatly appreciated. Here is my query: SELECT tblTerritory.TerritoryID, [TerritoryName] & " " & [TerritoryDescription] AS Description, tblTerritory.TerritoryTypeID, tblTerritoryType.TerritoryType, Max(tblTerritoryCheckout.DateCheckedOut) AS Checked...

show all fields in the Outlook 2007 task form
I see that a contact has "Show All Fields". Where is this option for tasks? I'd like to see some of these things in the task form, not just the table view. It's in the same place, only the standard task form hides that page. You'd need to design a custom task form that has that page visible. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "jay.meerdink@gmail.com" wrote: > I see that a contact has "Show All Fields"....

System Date
Can anyone help me on how to force the system date to a member field of "Date" type? I could not find any help on msdn that comes with visual c++. Any hint or help will be appreciated. Thanks, Behrouzk Are you just trying to get the current date. You can use CTime::GetCurrentTime() or COleDateTime::GetCurrentTime() Tom "Behrouzk" <Behrouzk@discussions.microsoft.com> wrote in message news:D8FA4B6B-73CE-4058-B50C-C9BEBAB67E68@microsoft.com... > Can anyone help me on how to force the system date to a member field of > "Date" type? I could not fi...

Conditional Formatting
Hi, I have a spreadsheet that is for tracking work. I would like to have conditional formatting so that if the date in column E is between todays date and 4 weeks away then make it blue, if it is a date that is after 4 weeks away then make it yellow but if it is in the past make it red. Can this be done with conditional formatting or does it need vba? Also it would be nice if the whole row changes colour even if just the condition is on the date which is in column E - but if that can't be done then just the cell is fine. Thanks Assume the dates start in E2, select all dates w...

access 2007 filtering
Somehow, in a database with four tables, I've lost the ability to filter on all tables. That is, when you click on the column header, only the sort option is available. The "select all" and other field values do not show. In the ribbon toolbar, click on the button FILTERS. This simply changes the column headings to something similar to what you would see in Excel (unfortunately). If you click on the dropdown for one of the column headings, you can then select the value for that column on which you wish to filter. On good thing about 07 is that when you click on the d...