Message Box twice pop-up between user frames...

keromero

New Member
Joined
Feb 20, 2025
Messages
18
Office Version
  1. 2016
I have three (3) different frames in same user form. I can successfully run below message box within the same frame.

However If I skip to other frames and click a text box, then message box appears twice?


*************************
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)

If Len(TextBox1) > 0 And IsNumeric(TextBox1) And TextBox1.Value > 0 Then
ComboBox6.Clear
Me.ComboBox6.Enabled = True
ComboBox6.AddItem "Option01"
ComboBox6.AddItem "Option02"
ComboBox6.AddItem "Option03"

Else

MsgBox "Enter a numeric value or a value greater than zero...", vbInformation, "MyBrand"
Cancel = True
TextBox1.Text = ""
Me.ComboBox6.Enabled = False

End If

End Sub
*************************

Note: ComboBox6 will be conditionally available when text box providing correct entry.

Thanks for help
 
Put a break point on the first line, then do whatever you do that triggers this, then step through the code (F8) and follow the execution. I suspect that setting the control to "" is causing the event to run again. On the 2nd pass it's length will be 0. I'd remove the Len test because you don't need it. If the value is numeric and is greater than 0 then it stands to reason that it's length is >0 also.
 
Upvote 0
Hİ Micron, code is working very fine as long as the code is running in the "same frame" loop. The issue when we switch from one frame to other in user form.

So I feel, what causes this "frame switching"

We better need to know whats behind "frame switching" cause twive message pop up.

Best Regards,
 
Upvote 0

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