Link to home
Start Free TrialLog in
Avatar of Chi Is Current
Chi Is CurrentFlag for United States of America

asked on

"Format(Date)" command in a form function crashes access on SOME workstations; not others

Hello ~

The "Format(Date)" command in a form function - to insert the date in an email message below - crashes Access (Microsoft Access has encountered a problem and needs to close, yada yada yada.....) on SOME workstations and not others!?   All workstations are running WXP, Outlook 2003, Access 2000 - SP-3.  And all workstations have the same libraries referenced.

When I remove the "Format(Date)" command it runs fine.

I'm stumped.  Can someone explain why this code runs on only some installations?

Many Thanks, Jacob
---------------------------------------------------------------------------

    Dim objMailItem As Outlook.MailItem
   
    Dim olkApp As Outlook.Application
    Dim olkNameSpace As NameSpace
   
   
    Set olkApp = New Outlook.Application
   
    Set olkNameSpace = olkApp.GetNamespace("MAPI")
    Set objMailItem = olkApp.CreateItem(olMailItem)

    With objMailItem
 
  .To = Forms!frmOrders!frmCountReq!contEmail
  .Recipients.ResolveAll
 
       Select Case Frame71.Value
     
     Case 1    '      Letter #1
 
  .HTMLBody = "<HTML><FONT SIZE=2>" & Format(Date) & " <BR><BR>>>For fastest response...........
Avatar of puppydogbuddy
puppydogbuddy

If you are refering to the Date function, I believe you need to change to the following syntax:

                Format(Date())
                               '^^^
Avatar of Chi Is Current

ASKER

puppydogbuddy - Thank you for your reply.  Yes, I am refering to the Date function.  However, when I type as it as you suggest, the VB editor in access removes the (), changing it to Format(Date).
ASKER CERTIFIED SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or whatever format you want to use.
Yes, I see - Format(Date) is incorrect syntax.  Format(Date, "mm/dd/yy") works.  I'll try it on client's workstations tomorrow.

Thank you for the correction.

Best Regards, Jacob
Glad I could help.  Thanks for the points and grade.