Re: UK Date format



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 -

.



Relevant Pages

  • Re: Problem in the data of the file in the FTP after the saving of ex
    ... format to General? ...     Widen the column or change the font size of that cell. ... The application when it copies the abcd.xls Sheet1 data to app.xls ...
    (microsoft.public.excel.misc)
  • Re: How format scsi HDD... help!
    ... allowing to format this disc in this compilation. ... disc HDD, without this tool? ... Save the hdd descriptor to disk. ...   to include formattable descriptors in the bootfile but most ...
    (comp.os.os9)
  • Re: Problem in the data of the file in the FTP after the saving of ex
    ... then excel will treat the value as a date and change the number format. ... helps with the FTP upload. ...     numberformat to General. ... Sheet1, Sheet2 of abcd.xls to the application excel file ideally ...
    (microsoft.public.excel.misc)
  • Re: Retrieving footer date format in PowerPoint
    ... Steve Rindsberg, PPT MVP ... tell, retrieve it by code. ... formatting the date then format the system date yourself to arrive at the same ...
    (microsoft.public.powerpoint)
  • Re: Text changes after .........
    ... Instead of Val you should use Csng or better still change to using the Currency data type (instead of the Single data type) and then use CCur to convert your string data. ... Also, the reason your second choice of Format function appears to be working is simplky because you have not included a "thousands seperator" in it, but you'll have problems in other areas if you continue to use Val for conversions and Singles for your values. ... By the way, it is usual to use the TextBox's Validate event rather than its LostFocus event for validating entries, because the Validate event occurs *before* the TextBox actually loses focus and you can cancel the shift of focus very easily just by setting the Cancel parameter to the appropriate value if your code doesn't like whatever the user has input. ...
    (microsoft.public.vb.general.discussion)

Loading