Re: UK Date format
- From: paul <paulquinlan100@xxxxxxxxxxx>
- Date: Thu, 26 Mar 2009 08:07:35 -0700 (PDT)
Resolved, just used your function Allen and its doing the business.
Thanks again.
Paul
On Mar 26, 1:53 pm, "Allen Browne" <AllenBro...@xxxxxxxxxxxxxx> wrote:
Paul, here's my experience from working with Access in a dmy country:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html
Internally, the value is a special kind of real number, where the integer
part represents the day, and the fraction the time (as a fraction of a day.)
The article explains how the presentation/entry in the interface is not the
same as the way a literal date should appear in a VBA statement or SQL
string. It's really important to get the difference.
I'm not clear what dFindSite and FindSite are in your code. If one of them
is an unbound text box, setting the Format *property* of the text box will
help Access understands the data type. If FindSite is a field, then forcing
the (date/time)? value in dFindSite to become a string (which is what
Format$() outputs), and then back to a date value again is unproductive,
serving only to increase the chance of a misinterpretation.
There is never a valid reason to use:
"\#dd\/mm\/yyyy\#"
when assigning a date value. In a SQL string or criteria, you always need:
"\#mm\/dd\/yyyy\#"
regardless of your local date format.
If you don't follow that discussion about data types, post a follow-up
indicating what dFindSite and FindSite are.
--
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.
"paul" <paulquinlan...@xxxxxxxxxxx> wrote in message
news:3d5feccb-b3c8-4194-8311-ff7030b1988f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Apologies for posting a question that has been asked and answered many
times but its been causing me a lot of grief!
I'm using the following code to prepare a (UK) date from a form to be
inserted into a table:
If IsDate(dFindSite) Then
If DateValue(dFindSite) = dFindSite Then
FindSite = Format$(dFindSite, "\#dd\/mm\/yyyy\#")
End If
End If
I've used this many times having found the above code on the list
previously, however now i get the error "Type-declaration character
does not match declared data type"
Any ideas where i'm going wrong?
Thanks for any suggestions.
Paul- Hide quoted text -
- Show quoted text -
.
- References:
- UK Date format
- From: paul
- Re: UK Date format
- From: Allen Browne
- UK Date format
- Prev by Date: Re: Combining Multiple Records Into Single Record?
- Next by Date: Re: access97, how to open adodb recordset to a local query
- Previous by thread: Re: UK Date format
- Next by thread: Re: UK Date format
- Index(es):
Relevant Pages
|
Loading