Button to Open New pop up, open email and close previous pop up (1 Viewer)

Aimn_4U

Registered User.
Local time
Today, 15:10
Joined
May 14, 2019
Messages
33
Hi all, I am hoping someone cal help me. I am aure this is simple but I cannot figure out how to do it.

I have created a popup form that has a button 'Send for Review', when this button is clicked it opens an email, and then another popup (SentRevDetails) which prompts the user to put in the date and who it was sent to.

I am having no problem with the button opening the email and new form, however I would like it to close once these are open. I have tried doing cmd.close in a few places within my code, but it wither stops the 'SentRevDetails' pop up opening or opens it and still does not close the pop up before.

Below is the code I am using.

Any help would be appreciated.

Private Sub Send_for_Review_Click()
Dim appOutlook As New Outlook.Application
Dim objEmail As Outlook.MailItem
Set objEmail = appOutlook.CreateItem(olMailItem)
With objEmail
.BodyFormat = olFormatHTML
.HTMLBody = "<font style =""font-family: Calibri""/font>" & _
"Dear , <br><br>" & _
"Please see below details of a precedent that requires your review.<br><br>" & _
"Attached is the documentation that was used for the previous assessment of this precedent.<br><br>" & _
"<b>Internal Unit Code: </b>" & Me.Internal_Unit_Code & "<br>" & _
"<b>Internal Unit Title: </b>" & Me.Internal_Unit_Title & "<br>" & _
"<b>External Unit Code: </b>" & Me.External_Unit_Code & "<br>" & _
"<b>External Unit Title: </b>" & Me.External_Unit_Title & "<br>" & _
"<b>External Institution: </b>" & Me.External_Institution & "<br>" & _
"<b>Precedent Linked to specific course, Major and/Or Stream: </b>" & Me.Course_Major_Stream_Code & "<br>" & _
"<b>Years/s basis unit was complete: </b>" & Me.Year_s_Basis_Unit_completed & "<br>" & _
"<b>Previously assessed by: </b>" & Me.Precedent_Assessed_by & "<br>" & _
"<b>Date of last assessment: </b>" & Me.Date_Assessed & "<br><br>" & _
"If you could, please review this precedent and return the outcome to us within 5 working days."
.Subject = "Precedent for Review"
.Display
End With
DoCmd.OpenForm "SentRevDetails", , , "[UnitEquivalence_ID] = " & Me.UnitEquivalence_ID
End Sub
 

vba_php

Forum Troll
Local time
Today, 02:10
Joined
Oct 6, 2019
Messages
2,884
can you please put your code inside *CODE* tags? this is how:

push_this_dropdown_button.jpg
 

GinaWhipp

AWF VIP
Local time
Today, 03:10
Joined
Jun 21, 2011
Messages
5,738
If I am understanding you correctly, you need to put the Close command and point to the correct Form on the opening of the next Form, i.e.

SQL:
Private cmd...
    DoCmd.OpenForm "YourForm"
    DoCmd.Close acForm, "TheFormYouWantToClose"
End Sub

On caveat is the Form you are opening cannot be pulling anything from the Form you are closing. If it is you will need to Hide instead of closing.
 

Users who are viewing this thread

Top Bottom