Solved

ActiveControl.Undo Not Working

Posted on 2001-08-16
8
400 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
  • 5
  • 2
8 Comments
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
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
Comment Utility
oops, leave out the

Screen.ActiveControl.Undo


cheers
Ricky
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
<<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
 
LVL 12

Accepted Solution

by:
Paurths earned 50 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:davidsanderson
Comment Utility
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
Comment Utility
well...

why the 'B' ?

just curious...

cheers
Ricky
0
 

Author Comment

by:davidsanderson
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now