C
CB Hamlyn
I have 42 comboboxes on a page. 14 RoomNames, 14 CarpetColors and 14
CarpetWeights.
I need to set some defaults, or blank out the colors/weights when someone
changes the room name. Under each of the cboRoom_X_Name_Change I have the
following code:
Private Sub cboOSN_CarpetRoom1Name_Change()
If Len(cboOSN_CarpetRoom1Name.Value) <> 0 Then
Range("DLVF_CarpetR1") = cboOSN_CarpetRoom1Name.Value
If Len(cboOSN_CarpetRoom1Weight.Value) = 0 Then
Range("DLVF_CarpetW1") = "40oz"
End If
Else
Range("DLVF_CarpetR1") = ""
Range("DLVF_CarpetC1") = ""
Range("DLVF_CarpetW1") = ""
End If
End Sub
I'd like to be able to have one procedure to do this work and simply pass
the number of the control to use. I'm trying something like this:
Private Sub cboOSN_CarpetRoom1Name_Change()
Call ChangeCarpetRoomName(1)
End Sub
Private Sub ChangeCarpetRoomName(NewCode)
Dim ctlcboName As Object
Dim ctlcboWeight As Object
ctlcboName = Controls("cboOSN_CarpetRoom1Name")
ctlcboWeight = "cboOSN_CarpetRoom" & NewCode & "Weight"
If Len(ctlcboName.Value) <> 0 Then
Range("DLVF_CarpetR" & NewCode) = ctlcboName.Value
If Len(ctlcboWeight.Value) = 0 Then
Range("DLVF_CarpetW" & NewCode) = "40oz"
End If
Else
Range("DLVF_CarpetR" & NewCode) = ""
Range("DLVF_CarpetC" & NewCode) = ""
Range("DLVF_CarpetW" & NewCode) = ""
End If
End Sub
This doesn't even come close to working, but I hope you can see what I'm
trying to do and can offer some help.
I used to program in FoxPro and they had a cool feature where you could
build a string like this:
strControlName = "cboCarpetRoom" & intControlNumber & "Name"
then do something like this:
&strControlName.Value = "Living Room"
Where the "&" told FoxPro to remove the quotes around the value of
strControlName and use it as an object. Does VB have anything like this?
Thanks for any help.
CB Hamlyn
CarpetWeights.
I need to set some defaults, or blank out the colors/weights when someone
changes the room name. Under each of the cboRoom_X_Name_Change I have the
following code:
Private Sub cboOSN_CarpetRoom1Name_Change()
If Len(cboOSN_CarpetRoom1Name.Value) <> 0 Then
Range("DLVF_CarpetR1") = cboOSN_CarpetRoom1Name.Value
If Len(cboOSN_CarpetRoom1Weight.Value) = 0 Then
Range("DLVF_CarpetW1") = "40oz"
End If
Else
Range("DLVF_CarpetR1") = ""
Range("DLVF_CarpetC1") = ""
Range("DLVF_CarpetW1") = ""
End If
End Sub
I'd like to be able to have one procedure to do this work and simply pass
the number of the control to use. I'm trying something like this:
Private Sub cboOSN_CarpetRoom1Name_Change()
Call ChangeCarpetRoomName(1)
End Sub
Private Sub ChangeCarpetRoomName(NewCode)
Dim ctlcboName As Object
Dim ctlcboWeight As Object
ctlcboName = Controls("cboOSN_CarpetRoom1Name")
ctlcboWeight = "cboOSN_CarpetRoom" & NewCode & "Weight"
If Len(ctlcboName.Value) <> 0 Then
Range("DLVF_CarpetR" & NewCode) = ctlcboName.Value
If Len(ctlcboWeight.Value) = 0 Then
Range("DLVF_CarpetW" & NewCode) = "40oz"
End If
Else
Range("DLVF_CarpetR" & NewCode) = ""
Range("DLVF_CarpetC" & NewCode) = ""
Range("DLVF_CarpetW" & NewCode) = ""
End If
End Sub
This doesn't even come close to working, but I hope you can see what I'm
trying to do and can offer some help.
I used to program in FoxPro and they had a cool feature where you could
build a string like this:
strControlName = "cboCarpetRoom" & intControlNumber & "Name"
then do something like this:
&strControlName.Value = "Living Room"
Where the "&" told FoxPro to remove the quotes around the value of
strControlName and use it as an object. Does VB have anything like this?
Thanks for any help.
CB Hamlyn