Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ActiveControl.Undo Not Working

Posted on 2001-08-16
8
Medium Priority
?
434 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
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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 12

Accepted Solution

by:
Paurths earned 150 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

963 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