Solved

ActiveControl.Undo Not Working

Posted on 2001-08-16
8
406 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 57
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

776 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