|
-
Feb 22nd, 2006, 07:06 AM
#1
Thread Starter
Fanatic Member
sending outlook using access vba
I'm tryng to send a form using access vba.
i have an outlook form put value on fields that comes from my database then send the form.
the problem is when i received the email..the form fields/controls has no value.
here's my sample code.have just put some string on it not the actual records.
VB Code:
Sub Transfer_ToMail()
Dim oApp As Outlook.Application
Dim oMsg As Outlook.MailItem
Dim oInspector As Outlook.Inspector
Dim oPages As Outlook.Pages
Dim oPage As Object
Dim oControls As Object
Dim oControl As Object
Set oApp = New Outlook.Application
Set oMsg = oApp.CreateItemFromTemplate("C:\Template\FORM_TEMP.oft")
If Not oMsg Is Nothing Then
Set oInspector = oMsg.GetInspector
Set oPages = oInspector.ModifiedFormPages
Set oPage = oPages("Email Notification")
Set oControls = oPage.Controls
Set oControl = oControls("FIELDNAME1")
oControl.Value = "AAA-AA"
Set oControl = oControls("FIELDNAME2")
oControl.Value = "COMPANY"
'oMsg.Display vbModal
oMsg.To = "Gates, Bill
oMsg.Send
Else
MsgBox "Couldnt find your template!"
End If
Set Inspector = Nothing
Set Pages = Nothing
Set Page = Nothing
Set Controls = Nothing
Set Control = Nothing
Set oMsg = Nothing
oApp.Quit
Set oApp = Nothing
End Sub
If a post has helped you then Please Rate it!
-
Feb 22nd, 2006, 07:16 AM
#2
Thread Starter
Fanatic Member
Re: sending outlook using access vba
would it matter if i design the controls with readonly properties? but when i tested this function and display the form the controls has the value i have programmtically entered. but when i send it to my self it return empty values on controls.
why did i select readonly on properties? because i wanted it to be uneditable when the receiver clicked the forward mail function.
If a post has helped you then Please Rate it!
-
Feb 22nd, 2006, 07:32 AM
#3
Thread Starter
Fanatic Member
Re: sending outlook using access vba
ok the problem occur because i have checked the readonly properties of controls..when i unchecked readonly from these controls then run my code it works fine.
but then again i did not solved the real issue which is the form should not be editable when email forwarding.
If a post has helped you then Please Rate it!
-
Feb 22nd, 2006, 07:37 AM
#4
Thread Starter
Fanatic Member
Re: sending outlook using access vba
ok heres another question..if i make a script that would handle event when the receiver hit the forward button..is this script would be available to the recepient when i send the form? is the script attached/connected with the form i've sent?
If a post has helped you then Please Rate it!
-
Feb 22nd, 2006, 08:08 AM
#5
Frenzied Member
Re: sending outlook using access vba
If you're just sending a form, you could use DoCmd.SendObject acForm, "frmFoo", .... although you won't have as many options as when programming Outlook.
Tengo mas preguntas que contestas
-
Feb 22nd, 2006, 08:38 AM
#6
Thread Starter
Fanatic Member
Re: sending outlook using access vba
my concern truly is with the outlook form that i've sent..i want it to be uneditable when the user i've sent the mail try to forward it.
If a post has helped you then Please Rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|