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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dim strAddress As String? 1

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
I am attempting to use checkboxes ("Me.CONTACTS.Group Email") to select specific email addresses ("Me.CONTACTS.Email_1") which will then all be added to a message upon clicking a button ("CommandEmail"). The following code gives me an error ('438' Object doesn't support this property or method). Any help here please?


Private Sub CommandEmail_Click()
Dim strHighAddress As String

If Me.[CONTACTS].[Group Email].Value = True Then
strHighAddress = Me.[CONTACTS].[Email__1].Value
Application.FollowHyperlink "mailto:" & "" & strAddress & ""
End If
End Sub
 

You are assigning a value to [blue]strHighAddress[/blue], then attempting to use [red]strAddress[/red] in your mailto function.


Randy
 
sorry that was a typo. same result when "" & strHighAddress & "" is used.
 



What is the actual VALUE in this variable?

Please use Debug.Print & COPY from the Immediate Window.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I toggled breaks and the problem seems to lie with the following line:

If Me.[CONTACTS].[Group Email].Value = True Then

Command button that holds code is on main form "CLIENTS", subform "CONTACTS" holds email address and checkboxes "Group Email".

Debug.print does not give me output other than original code of " & strHighAddress &
 
I don't understand what you are attempting to reference in the [red]red code[/red]. Three .s is generally wrong. What is [Contacts]?
Code:
Private Sub CommandEmail_Click()
  Dim strHighAddress As String

  If [red]Me.[CONTACTS].[Group Email].Value [/red]= True Then
    strHighAddress = [red]Me.[CONTACTS].[Email__1].Value[/red]
    Application.FollowHyperlink "mailto:" & "" & strHighAddress & ""
  End If
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Thanks duane....i am not getting errors anymore now that i have clarified format; however, only the first email address that is selected is being added to the message rather than all the addresses that have been selected. any thoughts?

Private Sub CommandEmail_Click()
Dim strHighAddress As String

If Me!CONTACTS.Form.[Group Email].Value = True Then
strHighAddress = Me!CONTACTS.Form.[Email__1].Value
Application.FollowHyperlink "mailto:" & "" & strHighAddress & ""
End If
End Sub
 
strike that, conditional should not be necessary but i do need to add something like the following, although i don't know the proper format/term for "add next record ad infinitum" until all the selected records have been added to the string:

Application.FollowHyperlink "mailto:" & "" & strHighAddress & "" & ";" & "" & next record &
 
i am a little confused.....both "Group Email" and "Email__1" are values in the same table "CONTACTS", so i'm not consolidating records from multiple tables...
 
Can you provide your significant table and field names and relationships? How about telling us what you want to do rather than how you want to do it.

The link I suggested doesn't require multiple tables.

Duane
Hook'D on Access
MS Access MVP
 
Sorry, let me clarify: i want to select specific email addresses and add them to 1 message. i have already created functionality in which if i double-click an email address it will open up a new message with address added; however, if i do this with multiple addresses, multiple messages open. i thought it would be best to add a checkbox next to each address and then utilize a command button to place all selected addresses into 1 message.

-command button "CommandEmail" is located on main form "CLIENTS"

-check box "Group Email" is located on subform "CONTACTS"

-text box "Email__1" is located on subform "CONTACTS
 
i don't understand what else i need to provide since i have listed the relevant table and field names and their relationships????
 


He ALSO asked,
Duane said:
How about telling us what you want to do rather than how you want to do it.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
i thought i answered that question with the following:

"i want to select specific email addresses and add them to 1 message
 
What is the field name that identifies which records are to be included. You mentioned a check box earlier but a check box is a control on a form and not a field name in a table. A text box is also not a field and a subform is not a table.

I would expect you to reply with something like:
[tt]
tblContacts
- GroupEmail yes/no field checked for selecting to email
- EmailAddress text field containing the email address
[/tt]
Your concatenate() expression might then look something like:
Code:
Concatenate("SELECT EmailAddress FROM tblContacts WHERE GroupEmail = True",";")
You might also need additional filtering in the where clause

Duane
Hook'D on Access
MS Access MVP
 
you are correct:

tblContacts
- GroupEmail yes/no field checked for selecting to email
- EmailAddress text field containing the email address

However, the following code generates compile error "expecting end sub". This code is supposed to go with command button, right?

Concatenate("SELECT EmailAddress FROM tblContacts WHERE GroupEmail = True",";")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top