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

Clear Form

Status
Not open for further replies.

bdm1

Programmer
Feb 4, 2002
75
US
I have an Access application which sends messages via Outlook. All works well except that when Outlook closes and the user is returned to Access, the original message is still on the form. I would like the form to be cleared and ready to accept new data. Below is the code used. Any suggestions? Thanks Much

Private Sub CmdEmail_Click()


'This will not activate the Outlook security warnings.
'It will open the email message in outlook and
'the message can be sent by clicking on the SEND button.
'This also allows the sender to add to the message.

Dim strWAEmail, strWABody, strWASubject As String
Dim objOutlook As Object
Dim objEmail As Object

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strWAEmail = Me!Email
strWASubject = "Phone Message"
strWABody = "You received a phone Call at:" & Chr(13) & " " & Me![MessDate] & " " & Me![MessTime] & Chr(13) & _
Chr(13) & "FROM: " & Me![FirstName] & " " & Me![LastName] & _
Chr(13) & "Of:" & " " & Me![Company] & " , " & Me![AreaCode] & " - " & Me![PhoneNumber] & Chr(13) & " " & Me![Message]
With objEmail
.To = strWAEmail
.Subject = strWASubject
.Body = strWABody
.Importance = olImportanceHigh
.Display
End With

Set objEmail = Nothing

End Sub
 
Something like

Set objEmail=Nothing
Me![ControlName]=""
End Sub
 
I would like the form to be cleared
What about this ?
Me.Undo

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I need to keep the record in the underlying table and then clear the form...Thanks
 
G'day fella,

Code:
DoCmd.GoToRecord , , acNewrec
?

JB
 
Thanks JB, works like a charm....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top