473,289 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 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.  
Sep 20 '22 #1
4 8631
NeoPa
32,554 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?
Sep 20 '22 #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.
Sep 20 '22 #3
DJRhino1175
221 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.
Sep 20 '22 #4
NeoPa
32,554 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).
Sep 21 '22 #5

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

Similar topics

0
by: ifeoma | last post by:
I have a script which sends emails through Access. It sends these emails as if it was sent through Outlook. I had no problem with this using Office 2000 but with the newer Outlook 2002 it asks if I...
4
by: Ecohouse | last post by:
I need to be able to access an Outlook folder and read each email and pull data from the email into tables in Access and move the email to another folder. I now about automation but am not sure...
4
by: Nicole | last post by:
I found this code below to use to send emails using VB with Outlook. However, it gives these errors. 'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and...
2
by: sbw | last post by:
I am getting an intermittent problem when I try to create an Outlook mail item using access vba. Having tested if outlook is already running so that I can either create an outlook.application or...
5
by: Kosmos | last post by:
I have traveled the world and the seven seas and I have yet to come up with an answer to this question.... So I'm adding an attachment to an email from access... The following is the code: ...
0
by: Tim Hunter | last post by:
Hi, i am using Access 2003 on Win2000 desktop. I have an application that supports a Customer db for a restaurant. This application will also select from the Customer table and either print labels...
6
by: ttamilvanan81 | last post by:
Hai. I needto Receive Email using Ms-Access and Outlook. On the receiving end, the user receives the email at the Outlook. When they opens the Email, the message box should have a button called...
1
by: Paul Brady | last post by:
This must be a common operation, but I have searched this newsgroup and have wrestled with the help messages, and I seem to need help with this simple task. I have an Access 2000 database which,...
8
by: Bay0519 | last post by:
Hi, I'm using access and outlook 2003. I have a form in access that show product test information (test #, action, etc) using product ID as PK. what I need to accomplish is once, the test...
7
Jerry Maiapu
by: Jerry Maiapu | last post by:
Hello everyone, I have searched the forum and internet on collecting data from outlook into access with custom formatting but no there is no resource to assist. I 'have looked at the following...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.