Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can 1 combo box have 2 after update procedures in it 1

Status
Not open for further replies.

Patentinv

Technical User
Aug 26, 2005
84
US
Hello,
Can 1 combo box have 2 different after update procedures in it? If so can you describe how?

Thanks--Any help will be much appreciated.
 
NO.
But why did you ask ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I am not so sure if the answer is no, but definately not so sure about the question either. I am theorizing here, not sure if it is possible.

1) build a class (clsMyCombo)
2) set a private variable
private withEvents mComboControl as combobox
3) In the Set Property
Public Property Set ComboBoxCntrl(theControl As combobox)
Set mComboControl = theControl
mComboControl.afterUpdate = "[Event Procedure]"
End Property
4) Define an event procedure
private sub mComboControl_afterUpdate()
do something
end sub
5) On your form instantiate a clsMyCombo

dim mcComboClass as new clsMyCombo
set mcComboClass.ComboBoxCntrl = me.combocntrlOne

Now here is the theory. Do some procedure at the form level on afterupdate. You then will trap the same event at the clsMyCombo, I think. If possible you have theoretically done 2 seperate event procedures.

Bottom line. I can not think of a reason to do it, besides a mental drill.
 
Hi, PHS
I did not realize that I needed to state why, sorry.
I currently have a combo box that is bound to a table with 2 fields and has 4 different options/records in it, with an after update procedure, that has different calculations for each record. I want to add a Dlookup command that will display
the record that is chosen and it will need to be placed in the
after update procedure of the combo box also. Is this possible?

Thanks-- any help will be very appreciated.
 
In an AfterUpdate event procedure you may write all the VBA code you want ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Here's more info. on what I'm trying to accomplish,
I currently have a combo box that is bound to a table with 2 fields and has 4 different options/records in it, with an after update procedure, that has different calculations for each record. I want to add a Dlookup command that will display the record that is chosen in another text box and it will need to be placed in the after update procedure of the combo box also. Is this possible?

Code that is currently in the after update procedure of the combo box.

Private Sub cbofelts_AfterUpdate()

Dim prp As Property, ctl As Control

Set prp = Me!cbofelts.Properties("ListIndex")
Set ctl = Me.txtfelts

If prp = 0 Then
ctl = ([TOTFLDSQ] / 4) + 0.4
ElseIf prp = 1 Then
ctl = ([TOTFLDSQ] / 2) + 0.4
ElseIf prp = 2 Then
ctl = [TOTFLDSQ] + 0.4
Else
ctl = ([TOTFLDSQ] / 3) + 0.4
End If

Set ctl = Nothing
Set prp = Nothing

End Sub

Code I need to add: (2nd after update procedure)

Me.Dlookfelts.Requery


Thanks-- any help will be very appreciated.
 
I don't see where is the problem.
Why not doing the requery just before the actual End Sub line ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi, PHV
My bad, I had two text boxes with the same control source. And
I thought it was an issue with trying to add two event procedures into a single combo. That's what I get for copying and pasting text boxes on my form.

Thanks--for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top