AfterUpdate for Control

koolwaters

Active Member
Joined
May 16, 2007
Messages
403
I have a form capturing client information. There may be the rare occasion when an application for a client has been rejected for some reason. On the form, there is an application status combo box with Completed, Incomplete and Rejected as the values.

If the application status is complete, I want to open a pop-up form so that I can enter the reason the application has been rejected.

I have the following code in the AfterUpdate event of the combo box but it does not work. I have also played around with it for a few days but nothing is working.

Here is the code:

Code:
Private Sub cboApplicationStatus_AfterUpdate()
Dim stdocname As String
stdocname = "fpopRejectionReason"
    
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    If (Me.cboApplicationStatus = "Rejected") Then
    DoCmd.OpenForm stdocname, acNormal, , acFormAdd
End If
End Sub

I have added the Save line this morning to see if that is why it is not working. Basically, when I choose "Rejected" as the application status, the record is saved and the form does not open.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I got it to work. Finally!

Code:
Private Sub cboApplicationStatus_AfterUpdate()
Dim stdocname As String
stdocname = "fpopRejectionReason"
    
    If (Me.cboApplicationStatus.Column(1) = "Rejected") Then
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenForm stdocname, acNormal, , acFormAdd
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top