PC Review


Reply
Thread Tools Rate Thread

HELP! with email code

 
 
=?Utf-8?B?c2N1YmFkaXZlcg==?=
Guest
Posts: n/a
 
      21st Feb 2007
I posted a message yesterday about help with code for creating an email but
maybe I am posting this too soon.

At the moment I have the following:

Private Sub Tracksht_Click()

Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String

strSubject = QueryID & " - " & Fin_InvNo & " - " & Qry_QryType & "Query"
strToWhom = ""
strMsgBody = Qry_PropAddress1 & vbNewLine & Qry_Description

DoCmd.SendObject , , , strToWhom, , , strSubject, strMsgBody, True

End Sub

I have two questions:

1) How do I compile text and fields into a string (as I have tried to do in
the "strSubject" above but doesn't seem to work). Is there something I am
missing?

2) The code above is in a button on the sub form. Some of the fields I
require are from the main form. I have tried the usual referencing but
doesn't work.

Cheers
 
Reply With Quote
 
 
 
 
=?Utf-8?B?c2N1YmFkaXZlcg==?=
Guest
Posts: n/a
 
      21st Feb 2007

I have another problem.

I have managed to sort out a basic email and the button works ok only when I
first open the database.

If I then click on the button again I get a '2957' run-time error

"Daniel" wrote:

> 1-
> strSubject = QueryID & " - " & Fin_InvNo & " - " & Qry_QryType & "Query"
> where are QueryID, Fin_InvNo, Qry_QryType defined? or are they control
> within the subform?If so, I'd do
> strSubject = Me.QueryID & " - " & Me.Fin_InvNo & " - " & Me.Qry_QryType &
> "Query"
>
> 2- To ref forms and subforms... I use
> Forms![FormName]![SubFormname]![...].Form.[ControlName]
> So in your case simply use the simplest form of the above listed code
> Forms![FormName].Form.[ControlName]
>
> Daniel
>
>
>
>
>
>
> "scubadiver" wrote:
>
> > I posted a message yesterday about help with code for creating an email but
> > maybe I am posting this too soon.
> >
> > At the moment I have the following:
> >
> > Private Sub Tracksht_Click()
> >
> > Dim strToWhom As String
> > Dim strMsgBody As String
> > Dim strSubject As String
> >
> > strSubject = QueryID & " - " & Fin_InvNo & " - " & Qry_QryType & "Query"
> > strToWhom = ""
> > strMsgBody = Qry_PropAddress1 & vbNewLine & Qry_Description
> >
> > DoCmd.SendObject , , , strToWhom, , , strSubject, strMsgBody, True
> >
> > End Sub
> >
> > I have two questions:
> >
> > 1) How do I compile text and fields into a string (as I have tried to do in
> > the "strSubject" above but doesn't seem to work). Is there something I am
> > missing?
> >
> > 2) The code above is in a button on the sub form. Some of the fields I
> > require are from the main form. I have tried the usual referencing but
> > doesn't work.
> >
> > Cheers

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Code: Email Object Record to an Email Address displayed in F =?Utf-8?B?cGVycGxleGVk?= Microsoft Access Macros 0 8th Jun 2007 12:16 AM
Run code on new email Steve Microsoft Outlook VBA Programming 1 20th Mar 2007 07:12 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 05:13 PM
email code =?Utf-8?B?TWFyaWU=?= Microsoft Frontpage 4 28th Oct 2004 04:36 PM
Code for validating email address in C# - validate email Henrik Nyberg Microsoft C# .NET 1 8th Aug 2003 11:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.