Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 32
  1. #16
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Please explain in more detail this statement. It went right over my head.
    When programming in VBA, it is good practice to use the period (.) when referring to object Properties or Methods, and the bang (!) when referring to members of a collection. A collection might be all open forms (e.g. Forms!Myform!....), all the controls on a form (e.g. Forms!Myform!txtFirstName or Me!FirstName), or all the fields in a recordset (e.g. rstCompany!Address1).

    MS Access can always interpret the ! correctly, and it usually can figure out what you are referring to if you use the period to refer to a form control or collection member, but not always, and you get an error that appears not to make sense (from personal experience!!).

    You will find that if you adhere to that convention of the period for properties and methods, vs the bang for collection members, you can reduce errors. Not only that, when reading your code you will know what you are referring to.

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Here is a screenshot of my reference window. I uploaded it a few minutes ago. I was not using your code because I did want to start the debugging process all over again. Most of my code works. Two parts do not and I need to know why; the ref window is below.

    What is the cause of this error?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  3. #18
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    You might need Microsoft Outlook 12.0 Object Library. Your version of Access 10 might be a different number then 12.0. Add that reference, then save and do a Debug/Compile again and see if you get errors. If you do, post exactly what the errors and post your email code again.

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Where do I find the Microsoft Outlook 12.0 Object Library. Is it available as an choice in the of MS Access 10 reference Window?

    Any help appreciated. thanks in advance.

    Respectfully,

    Lou Reed

  5. #20
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Yes it should be. Scroll down the list and select it. You do have MS Outlook on your PC right?

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I do have MS Outlook on my PC. Yes.

    R,

    Lou Reed

  7. #22
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    The error is still the same

    I got the error when I selected compile:

    User-defined type not defined

    I am attaching a zip file of the png screenshot which shows error and code where it occurred.

    I installed MS Outlook 14.0 Object Libaray. I could not find the 12.0 version.

    Respectfully,


    Lou Reed
    Attached Files Attached Files
    Last edited by Lou_Reed; 02-27-2017 at 10:12 AM. Reason: correction

  8. #23
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Outlook is misspelled on that line.

  9. #24
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Going back to you post #10 -

    You said you were getting compile errors, but the screen capture of your code doesn't highlight any.

    What is the error message you are getting when compiling, and which line of code is causing it?

    Sorry - posted before I saw Bulzie's observation

  10. #25
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but it crashes on the next line. I changed the Outlok to Outlook and that line compiled.

    Then I clicked debug and compile and it crashed on the following line.

    Set oEmail = oAppCreateItem(olMailItem)

    I can send a screenshot of it. But it crashed on this line. Which is the next on the program. You
    can see that from the old screenshot.

    This one seems to have not misspelled errors.

    What could be wrong?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  11. #26
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Try: Set oEmail = oApp.CreateItem(olMailItem) (missing period after oApp)

  12. #27
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Set oEmail = oApp.CreateItem(olMailItem)

    You are missing the period after oApp

  13. #28
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    This program keeps crashing

    Now it crashes or hangs ( I am not sure) which on the following line.

    oEmail.To = Me.txtTo

    I am sure why. The Me.txtTo
    is defined in the third subprogram. So may be that is the cause.

    This is very confusing. It seems to be okay yet it crashes on all of these lines.

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Thumbnails Attached Thumbnails 2017-02-27_14-45-18.png  

  14. #29
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Keeps Crashing part 2

    Here is the zipped program I was refereeing to in the earlier email.
    Attached Thumbnails Attached Thumbnails 2017-02-27_14-45-18.png  

  15. #30
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    I think your "With oEmail" needs to be higher. Try putting it above that line that is getting stuck(above the oEmail.To line). Save, compile and then try to run again.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Network Access Issue with Microsft Access 2013
    By dferreira in forum Access
    Replies: 6
    Last Post: 07-21-2016, 11:41 AM
  2. Microsft Access Query Help
    By rplum in forum Queries
    Replies: 2
    Last Post: 06-29-2016, 09:48 AM
  3. Replies: 0
    Last Post: 12-15-2014, 08:18 AM
  4. Replies: 11
    Last Post: 05-20-2014, 11:32 AM
  5. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums