Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I capture the "SENT" time in Outlook.

    I am using Outlook 98, Access 97 and I have a question about capturing the "SENT" time to a database. I am trying to use this code: set nms2= application.CreateItem(0)
    Rst.fields(11).value = nms2.Sent

    In a way it works because it will enter the time as 12:00 am all the time. Does anyone have any better ideas or recommendations?

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I capture the "SENT" time in Outlook.

    In my previous entry I was using "nms2.Sent" and at the suggestion of Rory I changed it to "nms2.SentOn". This is a little better as I am now geting "1/1/4501" in the db.

    Rst.AddNew
    set nms2= application.CreateItem(0)
    Rst.fields(11).value = nms2.SentOn
    Rst("Tasknum") = Counter
    Rst("txtstatus") = "Submit"
    Rst.fields(4).value=vrUser
    Rst.Update
    Rst.Close
    MyDB.Close

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: How do I capture the

    Depending on the information you need, you could clean up that Date/Time field in a number of ways. If it is going straight into an Access Date/Time field, I'm not sure why there would be a problem. Nevertheless, if the time does not matter, you could do something like this:

    Rst.fields(11).value = Format(nms2.SentOn, "mm/dd/yyyy")

    Does that do it?

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I capture the

    Just tried it and it came back with "Type Mismatch Format" and I forgot to mention I am trying to get the time.

    I also noticed that in Access 97, the field name is Sentit, the data type is Date/Time. But below in the General - Format I pick the Medium time (5:32 pm). When I go to a different line the format line is blank. Is this a problem also? Its been a while since I've worked with Access so I'm not sure.

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: How do I capture the

    > in Access 97, the field name is Sentit, the data type is Date/Time

    Hmmm... If you add this to your code -

    If rst.Fields(11).Type = dbDate Then MsgBox "It's a Date/Time"
    If rst.Fields(11).Type = dbTime Then MsgBox "It's a Time"

    - what do you get? If it's the first, your earlier code is correct. If it's the second, some conversion might be needed.

    > in the General - Format I pick the Medium time (5:32 pm)

    I don't follow this part. Try choosing no format, which should give you the default. Are the results more accurate?

Posting Permissions

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