Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Question Unanswered: Format(Now(), "dd-mmm-yyyy hh:nn:ss")

    H E L P. SOS MAYDAY
    Format(Now(), "dd-mmm-yyyy hh:nn:ss")

    The above function is used do display date and time in specified format. In my full version of Access this function functioning well both in code and query.
    Unfortunately this does NOT function as expected in some RT versions of my application.
    Can anyone tell me what could be the reason to this? Could it be a missing DLL or any wrong system settings.
    I'm now very frustrated about this problem, so any advice how to handle this would be highly appreciated.

    Thanks a lot
    Sincerely Vestigo

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Just for the heck of it....try placing the return contents of Now() into a Variant variable

    Dim TheDate As Variant
    TheDate = Now()
    MsgBox Format(TheDate, "dd-mmm-yyyy hh:nn:ss")

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    It could be a missing/invalid dll or something, but then I'd expect "undefined function in expression", #Error, #Name as the result in a text control...

    If you could post some details around where those errors occur (the code, controlsource (how it's formatted), query), then we'd perhaps be able to assist.

    When using non default settings (non US), there are lot's of possibilities. One suspection, is that somewhere there's a control, variable or field populated with/thru a date string, that's not properly interpreted by either a query, controlsource or code.

    Also keep in mind, if you're doing formatting with the "/" sign somewhere in code, that's inviting Access to pick up the local date separator in stead of "/" (which is dot (.)).

    I'm fond of the following formats:
    Format(Now, "yyyy-mm-dd hh\:nn\:ss")
    Format(Now "mm\/dd\/yyyy hh\:nn\:ss")
    Roy-Vidar

  4. #4
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Smile Hi Ha

    Your proposal "Format(Now, "yyyy-mm-dd hh\:nn\:ss")" did the job, both in query and in code. (I used Format(Now, "dd-mmm-yyyy hh\:nn\:ss"))
    Thanks a lot to both of you. I'm really satisfied with your proposals.

    Sincerely Vestigo

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    The other thing to also look at is the regional settings ... That also can be the culprit (especially since looking at your format, you're just changing the ordering of the date).
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •