Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Button clicks and textbox Exit events

I wrote:

"I'll call a sub to write data to the datasheet from the buttons' Click
event handlers and write handlers for the textboxes' Enter events to do
the same thing. The Exit event handlers will simply send up a "Changed
Data" flag for the other handlers to deal with. Here's hoping it
works."

It involves quite a bit more code in comparison to my original, but it
does indeed work. And it's even a bit faster for some reason.

Apparently, when VBA encountered this line in a textbox's Exit event
handler...

Cells(R, [FirstName].Column).Value = FieldEntry(1)

....and the Exit event was triggered by clicking on a button, VBA
updated the cell and then promptly forgot where the focus was supposed
to have gotten to. Therefore, it didn't run the button's Click
handler. By using the button's Click event handler to call a Sub that
in turn writes the data using Cells(), VBA is able to write the data
and continue with the handler. The focus doesn't get "lost" because
VBA doesn't deal with any other control.

I still wish I knew if the original code was encountering a bug in
Excel VBA, or if I was just missing something. Ah well.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count and Reset Button Clicks Arlen Excel Discussion (Misc queries) 3 May 12th 10 04:33 AM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Discussion (Misc queries) 2 August 1st 05 08:23 AM
Open an Outlook folder when a user clicks on a command button ... Rob Keel Excel Programming 2 August 1st 05 08:23 AM
Why 2 clicks on a command button cush Excel Programming 2 May 10th 05 07:16 PM
On Enter and On Exit events of MSFORMS controls? Haldun Alay[_3_] Excel Programming 1 November 4th 03 01:06 PM


All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"