IIf Statement

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

Can someone tell me why I'm getting #Name in the form control with this
formula?
=IIf([Projects Subform].[Form].[RecordsetClone].[RecordCount]=0,0,[Projects
Subform].[Form]![TotaldaysWorked])
I'm using Access 2003
Thanks
Tony
 
Tony said:
Can someone tell me why I'm getting #Name in the form control with
this formula?
=IIf([Projects
Subform].[Form].[RecordsetClone].[RecordCount]=0,0,[Projects
Subform].[Form]![TotaldaysWorked]) I'm using Access 2003
Thanks
Tony


RecordSetClone can ONLY be referenced in VBA, not in a ControlSource expression.
From the Help file...

The RecordsetClone property setting is a copy of the underlying query or table
specified by the form's RecordSource property. If a form is based on a query,
for example, referring to the RecordsetClone property is the equivalent of
cloning a Recordset object by using the same query. If you then apply a filter
to the form, the Recordset object reflects the filtering.

This property is available only by using Visual Basic and is read-only in all
views.
 
Rick this is a database using the Microsoft template for Time and Billing?
It's their code. Any suggestions as to how I could change it?
Thanks
Tony
Rick Brandt said:
Tony said:
Can someone tell me why I'm getting #Name in the form control with
this formula?
=IIf([Projects
Subform].[Form].[RecordsetClone].[RecordCount]=0,0,[Projects
Subform].[Form]![TotaldaysWorked]) I'm using Access 2003
Thanks
Tony


RecordSetClone can ONLY be referenced in VBA, not in a ControlSource
expression. From the Help file...

The RecordsetClone property setting is a copy of the underlying query or
table specified by the form's RecordSource property. If a form is based on
a query, for example, referring to the RecordsetClone property is the
equivalent of cloning a Recordset object by using the same query. If you
then apply a filter to the form, the Recordset object reflects the
filtering.

This property is available only by using Visual Basic and is read-only in
all views.
 
Tony said:
Rick this is a database using the Microsoft template for Time and
Billing? It's their code. Any suggestions as to how I could change it?
Thanks

If it were *code* it would be fine. Entering that directly into a
ControlSource expression though is not code.
 
Sorry to be so pedantic Rick and I know if it's wrong it's wrong, but as I
said that is the statement that is shown in the source line of the control
of a form that is part of Microsoft's Time and Billing template how could
they get it wrong? In fact it appears in about three different controls.
Funny thing is it works in Access 2000 but doesn't in Access 2003? Odd?
Tony
 
Tony said:
Sorry to be so pedantic Rick and I know if it's wrong it's wrong, but
as I said that is the statement that is shown in the source line of
the control of a form that is part of Microsoft's Time and Billing
template how could they get it wrong? In fact it appears in about
three different controls. Funny thing is it works in Access 2000 but
doesn't in Access 2003? Odd? Tony

It's possible that the "only available in code" was changed in later versions.
I was quoting the Access 97 help file.
 
Back
Top