By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,191 Members | 1,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,191 IT Pros & Developers. It's quick & easy.

Command Button to Create Email in Outlook Problem

P: 93
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.
May 22 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
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
May 22 '08 #2

P: 93
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.
May 22 '08 #3

Post your reply

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