473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

no compile errors but code doesn't work properly

1 New Member
wonder if anyone can help... I have access db with a whole lot of vb code... If i use access 2000 it works perfectly but when using 2003 it doesn't work properly. The db copies outlook mailboxes... I'm not quite sure why it wont work properly, i can copy my own mailbox but trying to copy some elses wont work, if i export the mailboxes directly through outlook then i can copy them... this isn't an outlook related issue... here is the code which doesn't seem to work:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CopyMailItems(ns As Outlook.NameSpace, strUserFullName As String, strRecip As String)
  2.     On Error GoTo CopyErrHandler
  3.  
  4.     Dim folder1 As MAPIFolder, oFolder As MAPIFolder
  5.     Dim strMailboxName As String, strStatus As String
  6.     Dim intConnect As Integer, intOther As Integer
  7.     Dim strDupTest As String, ErrString, strSearch As String
  8.     Dim Complete As Boolean
  9.  
  10.     Set dbs = CurrentDb
  11.     Set rst = dbs.OpenRecordset("Status")
  12.     MsgBox "copymailitems1", vbOKOnly, "test"
  13.     intConnect = ConnectToBox()
  14.     If intConnect = 6 Then
  15.     MsgBox "copymailitems2", vbOKOnly, "test"
  16.         strMailboxName = "Mailbox - " & strUserFullName
  17.         Set UserMailbox = ns.Folders(strMailboxName)
  18.         'If user has not connected to mailbox, rest of code will not run. Error Handler will "kick in"
  19.         strStatus = StatusTest()
  20.         MsgBox "copymailitems3", vbOKOnly, "test"
  21.         If strStatus <> "Copy Started" Then            
  22.         MsgBox "copymailitems4", vbOKOnly, "test"
  23.             strStatus = "Copy Started"
  24.             Call UpdateStatus(strStatus)
  25.         End If                                        
  26.         Screen.MousePointer = 11
  27.  
  28.     'Copy folders and its subfolders to empty pst
  29.         strPstFolderName = CreateEmptyPst(ns, strRecip, strUserFullName)
  30.         MsgBox "copymailitems5", vbOKOnly, "test"
  31.         Set PersonalFolder = ns.Folders(strPstFolderName)
  32.         For Each folder1 In UserMailbox.Folders  'ns.Folders(strMailboxName).Folders
  33.         MsgBox "copymailitems6", vbOKOnly, "test"
  34.             Set CopiedFolder = folder1.CopyTo(PersonalFolder) '****
  35.         MsgBox "copymailitems7", vbOKOnly, "test"
  36.         Next
  37.         MsgBox "copymailitems8", vbOKOnly, "test"
  38.         Set CopiedFolder = Nothing
  39.     'copy messages from top of Information Store to pst
  40.         For Each msg In ns.Folders(strMailboxName).Items
  41.             MsgBox "copymailitems9", vbOKOnly, "test"
  42.             Set CopiedItem = msg.Copy
  43.             CopiedItem.Move PersonalFolder
  44.         Next
  45.         Set CopiedItem = Nothing
  46.         Set oFolder = ns.Folders.Item(strPstFolderName)
  47.  
  48.         Screen.MousePointer = 0
  49.         Complete = VerifyContents(ns, strMailboxName)
  50.         If Complete = True Then
  51.             MsgBox "All items have been copied.", vbOKOnly + vbInformation, "Mailbox Copy"
  52.             strStatus = "Copy Complete"
  53.            ' Set objFolder = objName.Folders.Item("Personal Folders")
  54.            ns.RemoveStore PersonalFolder
  55.         Else
  56.             MsgBox "Please copy data to folders where differences have been noted. " & _
  57.                "Please revisit page once copying has been completed", vbOKOnly + vbInformation, _
  58.                 "Mailbox Copy"
  59.             strStatus = "Copy Partial"
  60.             DoCmd.OpenForm "frmCopyComplete"
  61.         End If
  62.         Call UpdateStatus(strStatus)
  63.     End If
  64.  
  65. CopyErrHandler:
  66.     Select Case Err.Number
  67.         Case -2147221233 'Not connected to user's mailbox in Outlook
  68.             intConnect = ConnectToBox()
  69.             If intConnect = 6 Then
  70.                 Resume
  71.             End If
  72.     Case Else
  73.         strSearch = "Can't copy folder." 'don't have permission to copy folder
  74.         ErrString = InStr(1, Err.Description, strSearch)
  75.         If ErrString = 1 Then
  76.             Resume Next
  77.         End If
  78.     End Select
  79.  
  80.     Screen.MousePointer = 0
  81.  
  82. End Sub
  83.  
  84. i have added the msgboxs which says copymailitems, just to try see where it stops working... it would seem like it is after this line:
  85.  
  86. MsgBox "copymailitems6", vbOKOnly, "test"
  87.             Set CopiedFolder = folder1.CopyTo(PersonalFolder)
  88.  
Any ideas or anything would be greatly appreciated...

Thanx
Aug 5 '09 #1
0 1529

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

Similar topics

4
2334
by: Thomi Richards | last post by:
Hi, I'm trying to create a simple stack class using C++ and templates. Everything works well and good if I amke the class totally inline. However, as soon as I try to seperate the class into a .h and a .cpp file, gcc throws some strange linking errors. Compiling like this:
12
2496
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current one is a permission error. The project is a VC++ Web Service. It works fine when the service is hosted on the old W2K dev machine, but on the...
5
3311
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;
10
19699
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I have a struct that contains several different types of data. This struct is used throuout the program. Now, when I compile, I get 6 errors, all of...
7
4488
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance. What I'd like to do this for, however, is discovering compile-time errors during my normal build. Currently, just a typo in a Property name goes...
9
4170
by: collection60 | last post by:
I've been developing some Unix based shell tools. They work fine on Linux and MacOSX. I want to compile them on Win32. But I can't get hash_map to compile. I tried downloading stl (and stlport) which is supposed to work in MSVC, but it doesn't, it just generates tons of errors for stuff that used to work just fine. Where do I get fts.h...
9
2408
by: Boris Yeltsin | last post by:
I use Master Pages, so I make use of URL rebasing through the ~ operator, like this in the <head>: <link runat="server" href="~/Root.master.css" media="screen" rel="stylesheet" type="text/css" /> It works perfectly and the ~ gets converted by the server into the correct relative path. Great! Now, I put this in the <head>: <script...
14
5496
by: mistral | last post by:
Need compile python code, source is in html and starts with parameters: #!/bin/sh - "exec" "python" "-O" "$0" "$@" I have installed ActivePython for windows.
9
2086
by: Finger.Octopus | last post by:
I dont know whats terribly going wrong with this, well I know there's some memory allocation with this but I tried hard to fix it and when it gets fixed it doesn't shows up the desired value, this is the code that shows the compile-time error: #include <stdio.h> #include <string.h> #define $WORD_LIST(X) "resource/" X
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5218
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.