Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference to MAPI

Status
Not open for further replies.

trevorwilliams2

Programmer
Mar 3, 2003
107
US
INFORMATION:
I have a client side application that is distributed to 2 different groups. Each app is a little different so I requires some manual tweaks prior to distributing.

PROBLEM:
MAPI, by default, is looking for it's libary inside of my mail folder on the exchange server. (?) This is fine as long as it is within the domain and the user has sufficiant access rights.
Problem is that when I move it to the group outside of the domain, the reference obviously does not work and the user gets a lot of VBA errors until I come and manually fix the reference.

QUESTION
Is there a way to specify the path to the reference when the DB is opened. I have been trying to figure this out but no luck......
 
When you say Reference, I think References available from the tools menu (at least through Access 2003).

Because MAPI is standard and works with docmd.sendobject and what program is used is determined by Internet Options (tools in Internet Explorer or Internet Options in some control panels), I do not think we are on the same page... As long as MAPI is setup, everything should work with commands that use MAPI.

So I am wondering if we mean the same things as reference and if you are using standard built in MAPI code or what are you using? - Maybe you accidentally posted in an Access forum and meant a different flavor of VB?
 
Access 2003, VBA Window, Tools > References.

Path to MAPI defaults to \\Mail\Users\trevorw\My Documents\mapifbx.tlb

Move or update the client to a different user / machine the path stays the same & errors are returned anywhere MAPI is touched.

(I am using this to post calendar & task items from Access to Outlook)

I dont know why this is doing this and was just hoping to go around it with some code telling the DB where to look for mapifbx.tlb when it is opened.
 
While I've never used it, there is a references collection for references.

Did you browse to the file?

From what I remember reading, as long as you keep the problem reference at the bottom of the list and code that fixes references runs first, you should be good.
 
Still looking...if anybody knows how to point at this it would be a big help. Thanks!!!
 
if you just remove the reference and add it back - does it work? or do you have to point it to exact path?


here is code to just remove all refs (except Access and VBA) and add it back:
Code:
Private Sub FixUpRefs()
           Dim r As Reference, r1 As Reference
           Dim s As String

           ' Look for the first reference in the database other
           ' than Access and Visual Basic for Applications.
           For Each r In Application.References
              If r.Name <> "Access" And r.Name <> "VBA" Then
                 Set r1 = r
                 Exit For
              End If
           Next
           s = r1.FullPath

           ' Remove the Reference and add it back.
           References.Remove r1
           References.AddFromFile s

           ' Call a hidden SysCmd to automatically compile/save all modules.
           Call SysCmd(504, 16483)
        End Sub

Here is code to get the user's network name so you can build the path, if you have to:

Code:
Public Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim gstrUserName As String
    gstrUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(gstrUserName, lngLen)
    If lngX <> 0 Then
        fOSUserName = Left$(gstrUserName, lngLen - 1)
    Else
        fOSUserName = ""
    End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top