473,484 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Appointments from Access 2K to Outlook 2K

I have an Access 2K DB that contains certain fields I want to pull into
an Outlook 2K task.

Here is my code:
--------------------------------------------------------
Function AddOutLookTask()
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
..Display
..Subject = "" ' I'd like to have my Client ID field here
..ReminderSet = False
..DueDate = "" ' I'd like to have my Next Contact Date field here
..Save
End With
End Function
--------------------------------------------------------

Here's the question (don't laugh ;)), what do I type so I can pull my
data from the DB? I placed the field names but kept getting this
error: Compile error: Variable not defined. I know I'm missing
somehting simple.

Thank you in advance for your help!

Nov 13 '05 #1
5 2357
Oh, if the form is open, you can refer to the fields like this:

..subject = me.txtSubject

I would put the code into a module outside the form and then pass
strSubject, lngClientID, etc to the function

Function AddOUtlookTask(byval strSubject as string, byval lngClientID
as Long...)

and then I could do this:

..Subject = strSubject
etc

The good thing about this is that your code is MUCH more modular and
you can use it elsewhere (export to another app)
PitchBlackSheep wrote:
I have an Access 2K DB that contains certain fields I want to pull into an Outlook 2K task.

Here is my code:
--------------------------------------------------------
Function AddOutLookTask()
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
.Display
.Subject = "" ' I'd like to have my Client ID field here
.ReminderSet = False
.DueDate = "" ' I'd like to have my Next Contact Date field here
.Save
End With
End Function
--------------------------------------------------------

Here's the question (don't laugh ;)), what do I type so I can pull my
data from the DB? I placed the field names but kept getting this
error: Compile error: Variable not defined. I know I'm missing
somehting simple.

Thank you in advance for your help!


Nov 13 '05 #2
Thank you so very much for your quick response!

I will give this a go. Just one more question, do I need to tell
access which database it needs to look at? Would it hurt to place
something like set db = CurrentDb or should I just leave it alone?
Cheers!!!

Nov 13 '05 #3
Here is the code now:

Function AddOutLookTask(ByVal strSubject As String)
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
..Display
..Subject = strSubject
..ReminderSet = False
..Save
End With
End Function

Get ready to laugh because I must have messed something up. I now get
a macro dialog box asking me to run or create one. What have I done
wrong? Thanks :)

Nov 13 '05 #4
No, you don't. Well, at least if you're just passing data from the
form's controls to Outlook. You don't because you don't need to go
anywhere else in the database hierarchy to get any other information.
(The form is already open, so it and its recordsource are already
available.)

so the function call could be something like this:

' Function AddOUtlookTask(byval strSubject as string, byval lngClientID
as Long...)

AddOutlookTask("Meeting with Joe", 15, ...)
no need to reference anything else.

Nov 13 '05 #5
Thank you for your help. When I entered in AddOUtlookTask(byval
strSubject as string, byval lngClientID asLong), Access kept asking me
to run a Macro so I changed my code just a bit more:

Option Explicit
Function AddOutLookTask()
Dim appOutLook As Outlook.Application
Dim taskOutLook As Outlook.TaskItem
Dim EscrowNo As Long
Dim NextContact As Date
Set appOutLook = CreateObject("Outlook.Application")
Set taskOutLook = appOutLook.CreateItem(olTaskItem)
With taskOutLook
..Display
..Subject = EscrowNo ' The Escrow Numbers are typed in, not
autonumbered
..ReminderSet = False
..DueDate = NextContact ' I have the date in the table as
1/15/05
..Save
End With
End Function

Outlook runs but all I get is a zero in the subject field and 12/1/99
in the date field. My form is open and the current record is active.
I'm ready to give up. Any last suggestions? Thanks :)

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
357
by: Pramod | last post by:
Experts I am also trying to create appointments for Outlook users on a specific Day and time. I was told you can't create appointments for others (but only for the user who is logged on). Is...
1
1243
by: Mark | last post by:
Hello, Can anyone help me out on how to pull a list of appointments using from Outlook using VB.NET where the appointments show date, time and description? Any help would be greatly...
16
6172
by: Kosmos | last post by:
Good afternoon everyone, just wondering if anyone knew if it's possible to send meetings or appointments through email when you run VBA or SQL code in Access 2003? The following is the code I've been...
1
7936
by: keri | last post by:
Hi everyone, After numerous failed attempts at this I am now trying again to solve this problem. I really would appreciate ANY help as I have been stumped with this for weeks and weeks! I...
1
2416
by: tbb | last post by:
hi I can create outlook apoointments using the outlook object model. But now to my problem, if the user edit/change the appointment in outlook I have inconsistent data because I store the...
0
1512
by: Stephen B. Burris Jr. | last post by:
In my database I need to keep the offices calendar up to date with the current information that my database is tracking. To do this I am entering events as appointments. Entering them into...
5
2991
by: mattkorguk | last post by:
Hi, Following the introduction of an appointment booking system in Access I've now given myself another issue. As I'm sending lots of appointments out I'm also then getting lots of the same...
0
1309
by: Ben Grimwade | last post by:
Hi, im developing an Application that integrates with Outlook by creating an appointment in there calender. The code in question is below Dim appt As Outlook.AppointmentItem obj =...
2
3027
by: =?Utf-8?B?RU1jQ2FydGh5?= | last post by:
My organization currently has interfaces in place to generate MS Outlook emails from our business applications. I am trying to determine if it is possible and how difficult it might be to...
0
1704
by: =?Utf-8?B?TWVlbWEgSnVkeQ==?= | last post by:
I have a Verizon Palm Treo 755p and use Outlook 2002 on my new HP Pavilion (Vista 64-bit). When I was syncing on my old XP PC, everything worked fine. On the Vista PC, when I finally got it to...
0
7080
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6950
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7103
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4841
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4527
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3044
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3038
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
588
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.