UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> I Use A Standard Template To Name Reports, But I Want To Remove A Word From The Standard If That Word Is Also A Parameter, Access 2013    
 
   
jmkeuning
post Feb 26 2020, 05:27 PM
Post#1



Posts: 255
Joined: 20-October 15



I use this to name a report as it is exported:

CODE
strReportName = Me.ProjectID & "-" & Me.ProjectCommGroup & " Group-" & [NowDate] + ".pdf"


Here are some Group Names:
Features & Functions
Intranet Advisory Group

This is great for Features & Functions Group-20200226.pdf but not so great for Intranet Advisory Group Group-20200226.pdf.

Is there a way that I can not use Group is part of the Group Name?

Here is whole deal:

CODE
Private Sub cmdGroupReport_Click()

    If Len(GroupEmails) < 1 Then
    MsgBox "Select a group with members or assign member to selected group."

Else:

Dim myPath As String
Dim strReportName As String

DoCmd.OpenReport "rptStakeholdersGroupsNoSubs", acViewPreview, , "GroupID = " & Me.GroupID
myPath = Forms.frmStart.ProjectRoot & "\"
strReportName = Me.ProjectID & "-" & Me.ProjectCommGroup & " Group-" & [NowDate] + ".pdf"

DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath + strReportName, True
DoCmd.Close acReport, "rptStakeholdersGroupsNoSubs"

MsgBox "The report is saved to " & Forms.frmStart.ProjectRoot & "\"

End If

End Sub
Go to the top of the page
 
theDBguy
post Feb 26 2020, 05:31 PM
Post#2


UA Moderator
Posts: 77,718
Joined: 19-June 07
From: SunnySandyEggo


Hi. Maybe you could try something like:

CODE
strReportName = Replace(Me.ProjectID & "-" & Me.ProjectCommGroup & " Group-" & [NowDate] + ".pdf","Group Group","Group")

Hope that helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
jmkeuning
post Feb 28 2020, 10:30 AM
Post#3



Posts: 255
Joined: 20-October 15



That's really cool. Thank you.
Go to the top of the page
 
theDBguy
post Feb 28 2020, 10:35 AM
Post#4


UA Moderator
Posts: 77,718
Joined: 19-June 07
From: SunnySandyEggo


Hi. Glad we could assist. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    31st March 2020 - 05:40 PM