Access 2003 #name! Error

G

Guest

I get a #name! error on my form where I have a the below code in Control
Source. I only get the error message when I am in Access 2003, but not 97,
2000, or 2002. I have only opened the file once on the 2003 machine. Is
there something that 2003 doesn't like in my code? Thank you!

---------Start Code---------
=IIf([CopyBWTotal].[Form].[RecordsetClone].[RecordCount]=0,"None",[CopyBWTotal].[Form].[sumofnew]-[CopyBWTotal].[Form].[sumofused])
-----------End Code----------

Also, I think it has nothing to do with it, but I get the Unsafe Expression
error message when I open the db. I know you can turn that off in the
options, but I didn't know if that was part of my problem.
 
A

Allen Browne

Steps to debug this:

1. Open the main form in design view.

2. Right-click the subform, and choose Properties.

3. On the Other tab of the Properties box, what is the Name property of this
subform? It can be different from the name of the form loaded into the
subform (its Source Object).

4. While you are there, double-check the name of the text boxes sumofnew and
sumofused. These look like calculated fields: if so, set the Format property
of the 2 text boxs to General Number so Access understands they are numbers.

5. The expression you entered sometimes returns text ("None"), and sometimes
numbers. Additionally, the numbers could possibly be Null. Try:
=IIf([CopyBWTotal].[Form].[RecordsetClone].[RecordCount]=0, 0,
Nz([CopyBWTotal].[Form].[sumofnew],0) -
Nz([CopyBWTotal].[Form].[sumofused],0))

If that still fails, use the Immediate Window (Ctrl+G) to determine which
part is not understood. You will need to add the main form name in that
context, but try this (assuming the main form is called Form1, and it is
open):
? Forms.[Form1].[CopyBWTotal].Form.RecordsetClone.RecordCount
 

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