Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Refer to combox from activecontrol name

Hi All,

In a userform with rows of comboboxes and textboxes, after exiting a
textbox, if there is nothing in it, and there is nothing in a combobox to
it's immediate left then "nothing", else do "this".

What I'm trying to do is with the ActiveControl name, I can ID the cbx to
the left, then check the cbx's value, and do this or that.

This is what I wrote, but I'm stumped.

With frm_tech_lv
Dim NameOfActiveControl As String
NameOfActiveControl = ActiveControl.Name
Dim CbxLvCtrlNm As String
CbxLvCtrlNm = "frm_tech_lv.cbx_tpl_" & Mid(NameOfActiveControl, 9,
4) & "_lc" & Right(NameOfActiveControl, 1)
Dim cbx As ComboBox
Set cbx.Name = CbxLvCtrlNm

If ActiveControl.Value = "" And cbx = "" Then
Else
MsgBox "From time needed."
Exit Sub
End If
End With

Any and all suggestions would be greatly appreciated. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Refer to combox from activecontrol name

Maybe

With frm_tech_lv
Dim NameOfActiveControl As String
Dim CbxLvCtrlNm As String
Dim cbx As Control

NameOfActiveControl = ActiveControl.Name
CbxLvCtrlNm = "frm_tech_lv.cbx_tpl_" & Mid(NameOfActiveControl, 9, 4) _
& "_lc" & Right(NameOfActiveControl, 1)

Set cbx = me.controls(CbxLvCtrlNm)

If ActiveControl.Value = "" And cbx.value = "" Then
Else
MsgBox "From time needed."
Exit Sub
End If
End With

BigPig wrote:

Hi All,

In a userform with rows of comboboxes and textboxes, after exiting a
textbox, if there is nothing in it, and there is nothing in a combobox to
it's immediate left then "nothing", else do "this".

What I'm trying to do is with the ActiveControl name, I can ID the cbx to
the left, then check the cbx's value, and do this or that.

This is what I wrote, but I'm stumped.

With frm_tech_lv
Dim NameOfActiveControl As String
NameOfActiveControl = ActiveControl.Name
Dim CbxLvCtrlNm As String
CbxLvCtrlNm = "frm_tech_lv.cbx_tpl_" & Mid(NameOfActiveControl, 9,
4) & "_lc" & Right(NameOfActiveControl, 1)
Dim cbx As ComboBox
Set cbx.Name = CbxLvCtrlNm

If ActiveControl.Value = "" And cbx = "" Then
Else
MsgBox "From time needed."
Exit Sub
End If
End With

Any and all suggestions would be greatly appreciated. Thanks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Refer to combox from activecontrol name

Hi Dave,

Thankyou! You're a life saver!
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
ActiveControl problem DAACKM Excel Discussion (Misc queries) 3 September 9th 08 01:15 AM
ActiveControl again Geoff Excel Programming 12 March 28th 06 11:05 PM
ActiveControl Geoff Excel Programming 2 March 24th 06 01:48 PM
Calendar Control & ActiveControl Marcus B Excel Programming 0 March 15th 06 10:08 AM
userform1.activecontrol.name Italian Job Excel Programming 3 November 14th 03 12:43 PM


All times are GMT +1. The time now is 09:24 AM.

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"