S
SirPoonga
I need to pass a control into a function.
Lets say I have a combo box called cboMake and one called cboModel.
In code I want to do this, how do I call refresh_cbo from update_cbo.
As typed it sends the value selected fromt he combobox.
Sub update_cbo()
cboMake.RowSource = "SELECT make FROM machine"
cboModel.RowSource = "SELECT model FROM machine"
refresh_cbo cboMake
refresh_cbo cboModel
End Sub
Sub refresh_cbo(mycbo As ComboBox)
Dim temp As String
Dim x As Integer
Dim itemexists As Boolean
mycbo.Requery
flag = False
For x = 0 To mycbo.ListCount
If temp = mycbo.ItemData(x) Then
mycbo = temp
itemexists = True
End If
Next x
If Not itemexists Then
mycbo = mycbo.ItemData(0)
End If
End Sub
Lets say I have a combo box called cboMake and one called cboModel.
In code I want to do this, how do I call refresh_cbo from update_cbo.
As typed it sends the value selected fromt he combobox.
Sub update_cbo()
cboMake.RowSource = "SELECT make FROM machine"
cboModel.RowSource = "SELECT model FROM machine"
refresh_cbo cboMake
refresh_cbo cboModel
End Sub
Sub refresh_cbo(mycbo As ComboBox)
Dim temp As String
Dim x As Integer
Dim itemexists As Boolean
mycbo.Requery
flag = False
For x = 0 To mycbo.ListCount
If temp = mycbo.ItemData(x) Then
mycbo = temp
itemexists = True
End If
Next x
If Not itemexists Then
mycbo = mycbo.ItemData(0)
End If
End Sub