Using control variable in a call

B

Bill

Given the code below where a user's selection
from a combo is being inserted into a text box
using a control varible. Can that control variable
also be used in some sort of calling syntax to
call the AfterUpdate event procedure that
corresponds to whatever text box is involved?

Dim tbcntl as control
Dim strWrk() as String

If Not tbcntl Is Nothing Then '
Control set?
tbcntl.SetFocus
' Need text box to have the focus
strWrk = Split(Me.cmboNameList.Column(0), ",") ' Okay, capture the
choice
tbcntl.Value = strWrk(1) & " " & strWrk(0) ' Format
user's choice
Me.cmboNameList.Visible = False ' Hide
until needed again
End If

Code needs to be compatible with A2K.

Thanks,
Bill
 
D

Dirk Goldgar

Bill said:
Given the code below where a user's selection
from a combo is being inserted into a text box
using a control varible. Can that control variable
also be used in some sort of calling syntax to
call the AfterUpdate event procedure that
corresponds to whatever text box is involved?

Not really -- you have to check the name of the variable and select from
among a hard-coded list of functions. Like this:

Select Case tbcntl.Name
Case "TextBox1": Call TextBox1_AfterUpdate()
Case "TextBox2": Call TextBox2_AfterUpdate()
' ... etc.
End Select
 
B

Bill

Dirk,
I was about to code it up that way when I decided
to check with the experts first...... oh well, but I thank
you anyway.
Bill
 

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