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
> After Update, Access 2016    
 
   
mike60smart
post Oct 16 2019, 06:57 AM
Post#1


UtterAccess VIP
Posts: 13,470
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I have the code below to check with the user are they sure they want to change the current saved Position.

If they user selects No then it sets focus back to the Combobox

However this action changes the displayed Combobox Value. How can I modify the code so that when they select No or Cancel it will revert to the previous Combobox Value??

Any help appreciated.

CODE
Dim lngValue As Long
      Dim strSQL As String

20    lngValue = MsgBox("Are you sure you want to change the current saved Position", vbYesNoCancel + vbQuestion, "Adding an Extra Position")
30    Select Case lngValue
         Case vbYes
40       If Me.Dirty Then Me.Dirty = False
50          DoCmd.RunMacro "mcrAppendTraining"
51          MsgBox "All Training requirements inserted", vbInformation
60       Case vbNo
70          Me.cboPosition.SetFocus
80       Case vbCancel
90          Me.cboPosition.SetFocus
100   End Select

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
arnelgp
post Oct 16 2019, 08:02 AM
Post#2



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


CODE


       Case vbNo
          Me.cboPosition = Me.cboPosition.OldValue
          Me.cboPosition.SetFocus
...


--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
arnelgp
post Oct 16 2019, 08:03 AM
Post#3



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


CODE


       Case vbNo
          Me.cboPosition = Me.cboPosition.OldValue
          Me.cboPosition.SetFocus
...


--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
mike60smart
post Oct 16 2019, 08:08 AM
Post#4


UtterAccess VIP
Posts: 13,470
Joined: 6-June 05
From: Dunbar,Scotland


Hi Arnelgp

Perfect. Thank you very much
hat_tip.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
arnelgp
post Oct 16 2019, 08:14 AM
Post#5



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


you're welcome!

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    14th November 2019 - 02:33 PM