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

Formatting as Date in a query expression

Hopefully this is a simple fix. I'm writing a select query, and I want
the user to enter a start date when the query opens, so I have this
expression:

StartDate: [Enter a start date:]

So I open the query, it prompts me and records the input. However,
what I need is for access to recognize that input as a date, which it's
not. I know this because in another query I have an equation involving
my StartDate field:

xVariable: [FutureDate]-[StartDate]

which returns nothing but #Error. If I change my StartDate equation
to:

StartDate: Date()

and run my second query, it gives me the number of days difference
between my FutureDate and Date(), like I want it to. That leads me to
believe that when I change StartDate to an input, the input isn't being
read in as a date.

Easy to fix? Is there a function that will force my input to be
formatted as a date field?

Feb 20 '06 #1
1 2498
"igendreau" <ia**********@hermanmiller.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hopefully this is a simple fix. I'm writing a select query, and I want
the user to enter a start date when the query opens, so I have this
expression:

StartDate: [Enter a start date:]

So I open the query, it prompts me and records the input. However,
what I need is for access to recognize that input as a date, which it's
not. I know this because in another query I have an equation involving
my StartDate field:

xVariable: [FutureDate]-[StartDate]

which returns nothing but #Error. If I change my StartDate equation
to:

StartDate: Date()

and run my second query, it gives me the number of days difference
between my FutureDate and Date(), like I want it to. That leads me to
believe that when I change StartDate to an input, the input isn't being
read in as a date.

Easy to fix? Is there a function that will force my input to be
formatted as a date field?

While looking at your query in design view, select Query>Parameters from the
menu and enter StartDate as DateTime. When you look at the SQL of your
query, you should now have something like:

PARAMETERS [StartDate] DateTime;
SELECT * FROM MyTable WHERE
SomeDate<[StartDate];

Although, this will help letting users enter dates via an input box can lead
to some interesting results.

Feb 20 '06 #2

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

Similar topics

1
by: Ken | last post by:
I wrote a function to use in queries that takes a date and adds or subtracts a certain length time and then returns the new value. There are times when my function needs to return Null values. ...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
5
by: allyn44 | last post by:
Hi--I have the following code to narrow a recordset search--I cannot seem to figure out how to format the date--I know this must be obvious but can't seem to figure it out-- thanks bob sql =...
2
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold...
7
by: Volodymyr Lozovoy | last post by:
Hi All, who suggest why subj do not affect on displayed result for date?
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
19
by: tymperance | last post by:
I have a datasheet form attached to a query that is searching for Expiration dates in four fields. The user inputs a date (query has on different rows for each field so the user only inputs one...
10
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?

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.