G
Guest
I have an application that controls inventory of land for sale. At times we
enter into an agreement to sell a lot but the deal is then cancelled for
whatever good reason. To record this event users now enter in a combo box the
string “Cancelled†to replace the name of the buyer. When they do a modal
form pops up asking if they want to do this, “yes†or “noâ€. If yes the form
closes and a number of updates take place and that works fine. (Sometimes
even a blind squirrel finds a nut).
But if they say “No†the form closes and they are back on the datasheet
(yes, datasheet, a given). I would like that combo box to revert to whatever
entry was there before. The idea being the user just made a mistake, easy to
do on a datasheet just hit the wrong line and then forgot what was there
before. I know, just tell them to hit {escape} but is there a way to do it
with SendKeys? I’ve tried but no luck.
Code follows:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
'attached to No button on frmBuyCancelledNotice
DoCmd.close
{Here is where I would like to have the combobox revert to previous entry}
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
Just FYI , this actually works, surprise, surprise
Private Sub Command3_Click()
With CodeContextObject
' Attached to yes button on frmBuyCancelledNotice
Forms!frmLaurieSheet!BuyClosingDate = Null
Forms!frmLaurieSheet![Date$Sent] = Null
Forms!frmLaurieSheet![Amount$Sent] = 0
Forms!frmLaurieSheet!Sold = "Cancelled"
Forms!frmLaurieSheet!Probate = False
Forms!frmLaurieSheet!Closed = "Cancelled"
Forms!frmLaurieSheet!Cancelled = True
Forms!frmLaurieSheet!DateCancelled = Date
Forms!frmLaurieSheet!Status = 2
DoCmd.close
End With
End Sub
As you can see I know just enough VBA to be dangerous.
enter into an agreement to sell a lot but the deal is then cancelled for
whatever good reason. To record this event users now enter in a combo box the
string “Cancelled†to replace the name of the buyer. When they do a modal
form pops up asking if they want to do this, “yes†or “noâ€. If yes the form
closes and a number of updates take place and that works fine. (Sometimes
even a blind squirrel finds a nut).
But if they say “No†the form closes and they are back on the datasheet
(yes, datasheet, a given). I would like that combo box to revert to whatever
entry was there before. The idea being the user just made a mistake, easy to
do on a datasheet just hit the wrong line and then forgot what was there
before. I know, just tell them to hit {escape} but is there a way to do it
with SendKeys? I’ve tried but no luck.
Code follows:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
'attached to No button on frmBuyCancelledNotice
DoCmd.close
{Here is where I would like to have the combobox revert to previous entry}
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
Just FYI , this actually works, surprise, surprise
Private Sub Command3_Click()
With CodeContextObject
' Attached to yes button on frmBuyCancelledNotice
Forms!frmLaurieSheet!BuyClosingDate = Null
Forms!frmLaurieSheet![Date$Sent] = Null
Forms!frmLaurieSheet![Amount$Sent] = 0
Forms!frmLaurieSheet!Sold = "Cancelled"
Forms!frmLaurieSheet!Probate = False
Forms!frmLaurieSheet!Closed = "Cancelled"
Forms!frmLaurieSheet!Cancelled = True
Forms!frmLaurieSheet!DateCancelled = Date
Forms!frmLaurieSheet!Status = 2
DoCmd.close
End With
End Sub
As you can see I know just enough VBA to be dangerous.