D
david.lauberts
Hi
I am trying to simply my code in a application by using a sub routine
to amend the control properties of a form but I can't seem to get
basic to accept the control property being sent to the routine as a
string
The code I am using is :
Private Sub lSubControlPropertySet(stForm As String, stControl As
String, stProperty As string, varValue As Variant)
If IsNull(varValue) = True Then
Forms(stForm)(stControl)(stProperty) = ""
Else
Forms(stForm)(stControl)(stProperty) =
varValue
End If
end sub
But access says it can't find the field, control or property name.
However the following works
Private Sub lSubControlPropertySet(stForm As String, stControl As
String, stProperty As string, varValue As Variant)
If IsNull(varValue) = True Then
Forms(stForm)(stControl).RowSource= ""
Else
Forms(stForm)(stControl).RowSource=
varValue
End If
end sub
I think I am referring or declaring the property element incorrectly
( I have tried using an property value (eg 3 for ControlSource) but
don't know exactly how to do it. Hope someone can help
Regards
Dave
I am trying to simply my code in a application by using a sub routine
to amend the control properties of a form but I can't seem to get
basic to accept the control property being sent to the routine as a
string
The code I am using is :
Private Sub lSubControlPropertySet(stForm As String, stControl As
String, stProperty As string, varValue As Variant)
If IsNull(varValue) = True Then
Forms(stForm)(stControl)(stProperty) = ""
Else
Forms(stForm)(stControl)(stProperty) =
varValue
End If
end sub
But access says it can't find the field, control or property name.
However the following works
Private Sub lSubControlPropertySet(stForm As String, stControl As
String, stProperty As string, varValue As Variant)
If IsNull(varValue) = True Then
Forms(stForm)(stControl).RowSource= ""
Else
Forms(stForm)(stControl).RowSource=
varValue
End If
end sub
I think I am referring or declaring the property element incorrectly
( I have tried using an property value (eg 3 for ControlSource) but
don't know exactly how to do it. Hope someone can help
Regards
Dave