Option Groups

W

Wendy

Hi, is there away to force an afterupdate event on an
option group (or any control) without sending keystrokes
or leaving the field?

Thanks
Wendy
 
N

Neil

Hi Wendy,

Not too sure on your question, but you can use Requery on most objects and
controls to get the latest information. For e.g.

To update a form:
Me.Requery
or
Forms!FormName.Requery

To update a control
Me.ControlName.Requery
or
Forms!FormName!ControlName.Requery

If you want to run the AfterUpdate event for a control from another
procedure then this is also possible. Say you have a textbox named
txtFirstName. The after update event for this control would look like:

Private Sub txtFirstName_AfterUpdate()

' Code for procedure goes here

End If

To run this code from anywhere else you would call it

Call txtFirstName_AfterUpdate
or
txtFirstName_AfterUpdate

Call is not required for this to work - more typing but easier to read. Its
up to you which way you do it.

HTH,

Neil.
 
W

Wendy

Thanks for your suggestion. when I do a requery it does
not update the field as I want it to. I'm using the space
bar to change the value of the field and thus toggle the
option group check boxes. but this does not have the same
update effect as using the arrow keys to toggle the boxes.
Im using:
on form_keydown(keycode)
If Me.ActiveControl.ControlType = acOptionGroup Then
If KeyCode = vbKeySpace Then
me.activecontrol = me.activecontrol +1
me.activecontrol.requery
endif

this does not have the same effect as

SendKeys ("{right}")

sendinig a "right" arrow keystroke updates the field.
requery does not.

thanks
Wendy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top