Issue with textbox_exit event

thorpyuk

Well-known Member
Joined
Mar 14, 2006
Messages
1,453
Hiya,

I've a userform with a textbox that allows me to pop in a comment.

I save what i write in the textbox back to my data sheet by using:

Code:
Private Sub TextBox35_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If blnHaltChange Then Exit Sub
If IsError(Application.Match(Val(TextBox1.Text), Worksheets("Project").Range("A:A"), 0)) Then Exit Sub
Sheets("Project").Range("AM" & f.Row).Value = TextBox35.Value
End Sub

However, i have a combobox that lets me select different records, and when i choose a different record, this does not trigger my exit event, and my comment is lost.


I tried putting Textbox44_Exit in my combobox change code, but it didn't like that.... has anyone any other ideas how i might force my exit event?

Thanks!
 
Thanks for both your replies...

Firstly, I added Msgbox "trying to exit" in at the first line of my exit event, and it didn't work, so the problem is that the exit event was not triggering!

dialup, i tried using afterupdate, and it seems that might do the trick, thanks!

What's the difference between Exit and Afterupdate?
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
thorpyuk

I've got an idea - explain what you are trying to achieve.:)

As far as I can see from this thread, and others, you seem to be overcomplicating things a bit.:eek:
 
Upvote 0
OvErCoMpLiCaTiOn is the name of the game Norie :>

What I have put together is a sort of bespoke project planning tool... it's hard to explain but it's got quite a lot going on, is a little overly complex in parts, and a little slow in others!

As i'm not very good at VB, i'm focussed mainly on getting stuff working, and then when i've accomplished this, i'll worry more about code efficiency etc.

As for this particular userform, it brings back data from a data sheet, and allows the user to make amends on the fly.... the textbox that is causing some pain is just a comments box - so, free text. I cant put any code in the change event because it saves after every keystroke, so i was using the exit event which i thought might just solve my problem :>

Hope that's as clear as mud :<
 
Upvote 0
Do you have any frames or multipage controls on this form?
 
Upvote 0
Hi Rory,

Yes I do... my comments textbox is actually within a frame.... will that make a difference?

The combobox i am switching to is not in the same frame.
 
Upvote 0
Yes, it will. The Exit event should only fire when you move focus to another control within that frame (or unload the form).
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,946
Members
449,134
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top