B
bymarce
Hi and thanks for your help! I have a subform that I use on several forms.
The subform is called subfrmConditions. I want to call this function in
cboCondition_AfterUpdate() to update the record source for cboUnits. On the
If statement I'm getting the error "Can't find Field refered to in your
expression". Thanks.
Marcie
Public Function ConditionsUpdateUnits(frmName As Form, FormName As String)
Dim sqlUnits As String
sqlUnits = "SELECT DISTINCT Units.Units " & _
"FROM Properties RIGHT JOIN Units ON
Properties.[UnitsType]=Units.[UnitsType] "
"WHERE (((Properties.Property)=Forms!" & FormName &
"!subfrmConditions.Form!cboCondition)) " & _
"ORDER BY Units.Units;"
If IsNull(frmName!subfrmConditions.Form!cboCondition) Then
frmName!subfrmConditions.Form!cboUnits.RowSource = "SELECT DISTINCT
Units.Units FROM Units ORDER BY Units.Units"
Else
frmName!subfrmConditions.Form!cboUnits.RowSource = sqlUnits
End If
End Function
The subform is called subfrmConditions. I want to call this function in
cboCondition_AfterUpdate() to update the record source for cboUnits. On the
If statement I'm getting the error "Can't find Field refered to in your
expression". Thanks.
Marcie
Public Function ConditionsUpdateUnits(frmName As Form, FormName As String)
Dim sqlUnits As String
sqlUnits = "SELECT DISTINCT Units.Units " & _
"FROM Properties RIGHT JOIN Units ON
Properties.[UnitsType]=Units.[UnitsType] "
"WHERE (((Properties.Property)=Forms!" & FormName &
"!subfrmConditions.Form!cboCondition)) " & _
"ORDER BY Units.Units;"
If IsNull(frmName!subfrmConditions.Form!cboCondition) Then
frmName!subfrmConditions.Form!cboUnits.RowSource = "SELECT DISTINCT
Units.Units FROM Units ORDER BY Units.Units"
Else
frmName!subfrmConditions.Form!cboUnits.RowSource = sqlUnits
End If
End Function