Solved

Access + Outlook + Late Binding - Saving an appointment rather than displaying it.

Posted on 2006-11-29
3
362 Views
Last Modified: 2008-03-17
Hi All,

I am slowly getting to grips (thanks to EE), with using Late binding to Outlook via MS Access 2003.  However, I can't solve one final issue.

My application currently allows the user to email an appointment, stored in the Access database, as a VCalendar to who ever needs it.  Using early binding this works fine using the following code:

With objRem
  'Field population goes here

  .SaveAs "C:\Foldername\Filename.vcs", olVCal
End with


I then create an email and attach this file.  For some reason I cannot use the olVCal part when using late binding.

Any ideas?

All the best
0
Comment
Question by:Andy Brown
  • 2
3 Comments
 
LVL 84
ID: 18036891
When using Late Binding the constants associated with the library won't be available unless you make them so. The easiest way to do it is to determine the acutal value of those constants and declare them in a Standard Module in your database:

Public Const olVCal As Long = 1
Public Const olVSomeotherValue As Long = 2

etc etc.

You can determine the value of your constants by remaking a reference to the Outlook library and then use the Object Browser to locate the constants you need.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 18036940
As an example, the value of olVCal is 7, so you'd need to do this:

Public Const olVCal As Long = 7

Other members of this enumaration (which is named OLSaveAsType) are:

olDoc =4
olHTML = 5
olCal = 8
olMHTML = 10
olMSG = 3
omMSGUnicode = 9
olRTF = 1
olTemplate = 2
olTXT = 7
olVCard = 6

The ONLY trouble with this approach is if Microsoft were to change the value of a constant ... say they decided, in Outlook 23, to change the value of olVCal to 122 ... if this were to happen, then your code would fail IF it were run on a machine with Outlook 23 installed. That said, the constant values almost never change (I can't recall an instance where they did), so your constant declarations should work fine.
0
 

Author Comment

by:Andy Brown
ID: 18037008
Perfect - thank you very much (again)

Really appreciated.

All the best.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now