Command Button to Create Email in Outlook Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clloyd
    New Member
    • Mar 2008
    • 91

    Command Button to Create Email in Outlook Problem

    I have a command button on two different forms that are exactly the same only named different. When you hit the button it creates an Outlook Email filling in the TO, Subject, and Email Text. It works on one form but not the other. Am I missing something on the form it is not working on. On the form that it does not work on it gives me a Compile Error: Variable not defined. I would have sent the code but I know it is correct since it works perfectly on one form. Thanks in advance.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Without actually laying eyes on your forms, my guess would be that the form that works has the option statement

    Option Compare Database


    as its first line, which is the Default when a form is created, but the misbehaving form has the option statement

    Option Explicit

    This second option requires that you explicitly define all variables before using them, with an appropriate Dim statement, such as

    Dim MyVariable as String

    and I'm guessing that you haven't done this. Either Dim all variables in the offending form, or change its Option statement.

    Welcome to bytes!

    Linq ;0)>



    Option Compare Database

    Comment

    • clloyd
      New Member
      • Mar 2008
      • 91

      #3
      Originally posted by missinglinq
      Without actually laying eyes on your forms, my guess would be that the form that works has the option statement

      Option Compare Database


      as its first line, which is the Default when a form is created, but the misbehaving form has the option statement

      Option Explicit

      This second option requires that you explicitly define all variables before using them, with an appropriate Dim statement, such as

      Dim MyVariable as String

      and I'm guessing that you haven't done this. Either Dim all variables in the offending form, or change its Option statement.

      Welcome to bytes!

      Linq ;0)>



      Option Compare Database
      Thanks that solved this problem.

      Comment

      Working...