Control Source error

A

astolfi

Hi all,

I'm trying use the Ledger template from Access 2003.

In the Accounts form, the "Account Balance" field contain the following
error: "#Name?". Why?

The control source is

=IIf([Accounts Subform].Form.RecordsetClone.RecordCount=0,0,[Accounts
Subform].Form!Balance)

and it seems that this code don't function properly.

Someone can help me?

Thanks
Alberto.
 
H

Howhiareu

is there any data in the system yet? Null values can produce that
condition when a field tries to evaluate a null value.

There is one way to try getting aroud this.

Put that line in a private form function something like this:

private function EvalBalance() as variant
 
H

Howhiareu

is there any data in the system yet? Null values can produce that
condition when a field tries to evaluate a null value. It may go away
as soon as there is a record added to the table.

There is one way to try getting aroud this.

Put that line in a private form function something like this:

private function EvalBalance() as variant
Dim Temp as variant
on error resume next
Temp = "0"
Temp=IIf([Accounts
Subform].Form.RecordsetClone.RecordCount=0,0,[Accounts
Subform].Form!Balance)
EvalBalance=Temp
on error goto 0
end function

then update the control source of that field like this:
=EvalBalance()

variants can return null values, while strings wont do it gracefully in
a situation like this. Also, this method allows you to monitor and
control an error state.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top