473,395 Members | 1,496 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,395 software developers and data experts.

Parameter Query and Date calculations....

Help!

I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result.

I then want to search through the records and select those with dates (as
caluclated above) within a user defined range, and so I am using a parameter
query. However, this query returns dates outside of the range and appears to
have particular problems in differentiating between years (2005 cf 2006).
But when the dates are not calculated but worked out and entered manually
the correct records are selected using the same criteria.

Since both my criteria and the equation work correctly independantly I am
assuming the problem is somehow related to the way Access stores dates. Does
anyone know anything about this or how I could resolve the problem?

Any suggestions would be greatly appreciated!

Julie
Nov 13 '05 #1
2 6490
Access is not good at determining the data types of calculated query fields,
parameters, and unbound controls. You will need to help it understand the
data type you intend, and it will then return the correct results.

Wrap the calculated date field in CVDate()
Declare any parameter in your query.
If the query refers to an unbound control on a form, set the Format property
of the control to Short Date or similar.

More details in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

The way Access stored the date/time data is not the problem. If you use
non-US dates, you might like to read this also:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Julie Wardlow" <jl*******@supanet.com> wrote in message
news:r6****************@newsfe7-gui.ntli.net...
Help!

I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result.

I then want to search through the records and select those with dates (as
caluclated above) within a user defined range, and so I am using a
parameter
query. However, this query returns dates outside of the range and appears
to
have particular problems in differentiating between years (2005 cf 2006).
But when the dates are not calculated but worked out and entered manually
the correct records are selected using the same criteria.

Since both my criteria and the equation work correctly independantly I am
assuming the problem is somehow related to the way Access stores dates.
Does
anyone know anything about this or how I could resolve the problem?

Nov 13 '05 #2
Thanks,

It appears my problem was to do with the specification of formats although
the CVDATE() didn't make any difference to the records that were returned.
However, I have sorted the it by taking out the IIF part of the formula and
using criteria to determine when to run the formula and the then using an
append query so the calculated date is added to a field in a table with the
specifies format as date/time. This seems to have got round the problem even
if it hasn't solved it directly!

Thanks for your help, I shall certainly be more careful with formats in the
future,

Julie

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:43*********************@per-qv1-newsreader-01.iinet.net.au...
Access is not good at determining the data types of calculated query
fields, parameters, and unbound controls. You will need to help it
understand the data type you intend, and it will then return the correct
results.

Wrap the calculated date field in CVDate()
Declare any parameter in your query.
If the query refers to an unbound control on a form, set the Format
property of the control to Short Date or similar.

More details in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

The way Access stored the date/time data is not the problem. If you use
non-US dates, you might like to read this also:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Julie Wardlow" <jl*******@supanet.com> wrote in message
news:r6****************@newsfe7-gui.ntli.net...
Help!

I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result.

I then want to search through the records and select those with dates (as
caluclated above) within a user defined range, and so I am using a
parameter
query. However, this query returns dates outside of the range and appears
to
have particular problems in differentiating between years (2005 cf 2006).
But when the dates are not calculated but worked out and entered manually
the correct records are selected using the same criteria.

Since both my criteria and the equation work correctly independantly I am
assuming the problem is somehow related to the way Access stores dates.
Does
anyone know anything about this or how I could resolve the problem?


Nov 13 '05 #3

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

Similar topics

11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
5
by: MX1 | last post by:
Simpler way to ask question from my previous post. I wrote a query and it has a paramter field in it. I want to enter a date with the current year. If it I put in 6/30/2003, it works great. If I...
2
by: Stewart Allen | last post by:
Hi There I have a function that does some calculations depending on the 2 date arguments passed into it: Function GetPeriods(dteStart As Date, dteEnd As Date) As Integer The function has 2...
8
by: MacDermott | last post by:
I have a query, which gathers up information, which is subsequently dumped into an instance of Excel using recordsetcopy. For one of the query fields, I have written what should be a pretty...
15
by: Rolan | last post by:
There must be a way to enhance the performance of a query, or find a plausible workaround, but I seem to be hitting a wall. I have tried a few tweaks, however, there has been no improvement. ...
14
by: Crimsonwingz | last post by:
Need to calculate a sum based on a number of factors over a period of years. I can use formula ^x for some of it, but need totals to carry over in the sum and have only been able to do this thus...
4
by: jstaggs39 | last post by:
I have a form that requires a start date and an end date as input for the parameters then runs the form which open queries which are designed to populate certain tables. As it stands now, i can...
5
by: vinfurnier | last post by:
Hi - I've been struggling to produce a working parameter query that will allow the end user to type in any date (mm/dd/yy) and obtain the records of the previous 2 days. In other words, if the...
4
by: pokerboy801 | last post by:
OK, I will try to explain this as clearly and as concise as possible. I am using Access, which has three MS Excel Linked tables, to store call center metrics for reps. My Excel workbook has three...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.