471,320 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,320 software developers and data experts.

Using Access VBA to update Outlook

266 256MB
I was curious if there is a way to use a form in access and send that data to the default outlook calendar as an appt. I have tried this code but it doesn't seem to work.

Expand|Select|Wrap|Line Numbers
  1. Dim olApp As Outlook.Application
  2.   Dim objAppointment As Outlook.AppointmentItem
  3.   Dim objAppointments As Outlook.MAPIFolder
  4.   Dim objNameSpace As Outlook.NameSpace
  5.   Dim objProperty As Outlook.UserProperty
  6.   Dim OutlookStartTime, OutlookEndTime As Date
  7.   Dim sFilter As Variant
  8.  
  9.   OutlookStartTime = CDate(ap_date & " " & ap_start_time)
  10.   OutlookEndTime = CDate(ap_date & " " & AP_End_Time)
  11.  
  12.   Set olApp = CreateObject("Outlook.Application")
  13.   Set objNameSpace = olApp.GetNamespace("MAPI")
  14.   Set objAppointments = objNameSpace.GetDefaultFolder(olFolderCalendar)
  15.  
  16.   sFilter = "[Start] = '" & Format(OutlookStartTime, "ddddd h:nn AMPM") & _
  17.     "' And [End] = '" & Format(OutlookEndTime, "ddddd h:nn AMPM") & "' " & _
  18.     " And [Subject] = '" & Me.ap_with_whom & " - " & Me.ap_type & "'"
  19.  
  20.   Set objAppointment = objAppointments.Items.Find(sFilter)
  21.  
  22.   If Not TypeName(objAppointment) = "Nothing" Then
  23.     objAppointment.Delete
  24.   End If
  25.  
  26.   Set objAppointment = Nothing
  27.   Set objAppointments = Nothing
  28.  
1 Week Ago #1
4 4491
NeoPa
32,405 Expert Mod 16PB
Grrrr.

265 posts and you're still writing questions like this? You should be embarrassed. Copy/pasting a chunk of code with a short sentence explaining ???. What? It doesn't work!

What works? What doesn't? Does it even compile? What do you see to show you it doesn't work if/when you try to run it?
1 Week Ago #2
didacticone
266 256MB
HAHAHA, OK... I wrote a quick post to start a dialog... what's up your ass dude? Apologies, I haven't grown at the programming pace you would like, no need to turn toxic about it. Asking a question on a forum intended for questions to be asked is embarrassing? Sad that you feel so entitled on a message board to talk to people like this, that's what is actually embarrassing, lol. That's the sad thing about you keyboard warriors. Get me banned or whatever you want big shot, enjoy the power, lol. Later my friend.
1 Week Ago #3
DJRhino1175
204 128KB
I did build a database based on what's in the code above and had to add a reference to Microsoft outlook. Once I did that everything compiled. So I tried running the code using a Click a button, but nothing seemed to happen. When I opened outlook no new appointment was made. I hope this helps with getting this figured out for the one asking the question.
1 Week Ago #4
NeoPa
32,405 Expert Mod 16PB
You're 100% wrong. I was biting my tongue.

In reality it seems clear to me that you're both lazy and entitled. Your minimalist attempt at a question wasn't just embarrassing - it was actually quite shocking. New members get away with that as it can be confusing for someone new to asking questions on a forum exactly what is expected and how best to go about doing that.

In your case however, this is repeated behaviour, and this isn't the first time I've had to make the same point. It's not an uncommon response from those who feel thus entitled to do Sweet Fanny Adams as far as their own effort's concerned and expect others to do all the heavy lifting on their behalf, to get all upset and hard-done-by when someone, who is there purely and simply to help, has to get side-tracked into explaining that it's not even possible when those asking the questions avoid including any of the information that would be required in order to provide such help.

You're right - almost. As administrator, and even as a moderator, I wouldn't need to get you banned as we have the power to ban you directly for a period, but that would be like using physical violence on an impertinent child. It would reflect worse on me even than on you. Be warned - I will never be so lenient when I come across such behaviour with any of my junior colleagues.

I can't help feeling that you've rather soured your chances of getting some of our volunteer experts to make the extra effort to help you though, when you react in such an entitled way. I know that I steer well clear of such members when I see behaviour like that (Other than continuing to monitor of course).
1 Week Ago #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Ecohouse | last post: by
reply views Thread by Tim Hunter | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.