Solved

ActiveControl.Undo Not Working

Posted on 2001-08-16
8
424 Views
Last Modified: 2012-08-13
Here's the code:

Private Sub cboDesignAssociateID_Change()
    If Screen.ActiveControl.Column(2) = True Then
        MsgBox "Selection """ & Screen.ActiveControl.Column(1) & """ is inactive, please choose another.", vbExclamation, AppName
        Screen.ActiveControl.Undo
        Screen.ActiveControl.Dropdown
    End If
End Sub

if the user selects an inactive selection, then i want a message to pop up saying that this selection is inactive and undo the combo box and drop it down.

the message and the dropdown part works buts its not undoing the control! if i use Sendkyes "{Esc}" instead, it undoes the whole record, not cool.  arrrgghh!!! i cant stand access's little quirks!!!  sorry.
0
Comment
Question by:davidsanderson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 12

Expert Comment

by:Paurths
ID: 6393408
hi davidsanderson,

try this


Private Sub cboDesignAssociateID_Change()
   If Screen.ActiveControl.Column(2) = True Then
       MsgBox "Selection """ & Screen.ActiveControl.Column(1) & """ is inactive, please choose another.", _
vbExclamation
       Screen.ActiveControl.Undo
       Screen.ActiveControl = ""
       Screen.ActiveControl.Dropdown
   End If
End Sub
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6393413
oops, leave out the

Screen.ActiveControl.Undo


cheers
Ricky
0
 
LVL 58
ID: 6393463
<<the message and the dropdown part works buts its not undoing the control! if i use Sendkyes "{Esc}"
instead, it undoes the whole record, not cool.  arrrgghh!!! i cant stand access's little quirks!!!  
sorry. >>

  It's not a quirk, it's defined behaviour.  First time esc is pressed it undoes the current control, second time the record.  If the current controls is not dirty (can't be undone), then it does the record.

  Since your not being explicit, Access does what it's design to do.

  Also, I'd avoid the use of ActiveControl at all costs.  It's a pain to debug.

Jim.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
Paurths earned 50 total points
ID: 6393490
so then it would look like :

Private Sub cboDesignAssociateID_Change()
   If cboDesignAssociateID.Column(2) = True Then
       MsgBox "Selection """ & cboDesignAssociateID.Column(1) & """ is inactive, please choose another.", _
vbExclamation
       cboDesignAssociateID = ""
       cboDesignAssociateID.Dropdown
   End If
End Sub


cheers
Ricky
0
 

Author Comment

by:davidsanderson
ID: 6394136
ok, thanks ricky, that lead me in the right direction.  i gave up on trying to undo it.

    If Screen.ActiveControl.Column(2) = True Then
        MsgBox "Selection """ & Screen.ActiveControl.Column(1) & """ is inactive, please choose another.", vbExclamation, AppName
        Screen.ActiveControl = Screen.ActiveControl.OldValue
        Screen.ActiveControl.Dropdown
    End If
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6395395
well...

why the 'B' ?

just curious...

cheers
Ricky
0
 

Author Comment

by:davidsanderson
ID: 6395622
the answer you gave wasnt exactly the code i ended up using, but it did lead me in the right direction, thanks bro!  everytime i give a B, i get the question of why.  does everyone else always give A's?
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6398498
well,

u can give whatever grade u want ofcourse, but most give A b/c the comments either led them in the right direction, or was right on the spot.
There have been lots of discussions about grading, but like i said most users give the A out of appreciating the free help they get. No matter if the problem was a brain-breaker or not.
Argument is that when not enough info is provided the questioner keeps asking and says the kind of grade they are planning to give, so the responders can adjust the comments ...

more info on grading : http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3

cheers
Ricky
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question