Phil,
Don't you have a small sandbox database file that you can test stuff? That's the easiest way to learn and try out different solutions without affecting your applications. I can't test other date formats because I won't mess with my regional settings in the control panel.
If your dates are dependent on year, you would need to also change the code you suggested which is not acceptable.
Please provide the full specifications of what you need so that someone can assist.
Regards,
Duane
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Phil Knowles pdk444444@yahoo.co.uk [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, August 2, 2017 5:01 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Date comparisons in a form control
Sent: Wednesday, August 2, 2017 5:01 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Date comparisons in a form control
I forgot to put the #s John - I did have them and still had the same problem.
When you asked Douane if my dates were in US format that rang a bell - I am in the UK and the date I am comparing to is 1st August - so do I simply use #08/01/17# instead of my natural inclination to use #01/08/17# ?
What about code to enable this to work from year to year without recoding?
many thanks
On Wednesday, 2 August 2017, 20:28, "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
Phil-
You're comparing a date to 1 divided by 8 divided by 17. :-)
If [date placed] < #1/8/17# Then
John Viescas, author
John Viescas, author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Access Applications
www.viescas.com If you're at all interested in Microsoft Access or SQL Server, this is the place to be! Check out the book recommendations and all the cool links! |
On Aug 2, 2017, at 12:31, pdk444444@yahoo.co.uk [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Hi Guys
This one should be straightforward I hope ....
In a form control I am trying to prevent the user from putting in an incorrect date.
I only want the date to be between 1/8/17 and the current date
I have the following code triggered by the On Exit event of the control
if [date placed] < 1/8/17 then
msgbox "date placed cannot be before 1/8/17"
[date placed] = null
elseif [date placed] > date then
msgbox "date placed cannot be in the future"
[date placed] = date
end if
the elseif seems to work perfectly but the test for before 1/8/17 doesn't work properly.
What am I doing wrong?
Also, so that I don't have to change the code each year, how can I code it so that between 1/8/nn and 31/7/nn+1 it uses 1/8/nn for the date test?
cheers
Phil
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar