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!

Command Button Syntax 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I'm working with a command button that e-mails an Access report when clicked (see its syntax below). The button caption says "Click here to submit your request." I've just added code so that
after the form has been worked the button's caption says "RESUBMIT YOUR REQUEST."
---
So what I need to do is have the strSubject = "RESUBMITTED REQUEST#" & Forms![RequestForm]![ID] if the button's caption = "RESUBMIT YOUR REQUEST".
And if the button's caption = "Click here to submit your request.", strSubject should then = "New Ad Hoc Report Request #" & Forms![RequestForm]![ID]

Does this make sense? How can this be accomplished? Thanks for your help.
--

Private Sub Submit_Click()
On Error GoTo Err_submit_Click

Dim stDocName As String
Dim strOutputFormat As String
Dim strRecipName As String
Dim strSubject As String
Dim strCCName As String

stDocName = "ReportRequest"
strOutputFormat = "Snapshot Format"
strRecipName = "someone@somewhere.com"
strSubject = "New Ad Hoc Report Request #" & Forms![RequestForm]![ID]
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.SendObject acSendReport, stDocName, strOutputFormat, strRecipName, , , strSubject
DoCmd.Quit

Exit_submit_Click:
Exit Sub

Err_submit_Click:
MsgBox Err.Description
Resume Exit_submit_Click

End Sub
 
strSubject = iif(Button.caption = "RESUBMIT YOUR REQUEST" , "RESUBMITTED REQUEST#" & Forms![RequestForm]![ID], "New Ad Hoc Report Request #" & Forms![RequestForm]![ID]")
 
Good job....it works great.

Thanks AskMan!
 
you're welcome ...
didn't it merit a vote ? (joke)

bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top