Iif function not functioning in another computer

M

Mishanya

I have a few unbound text boxes in my form wich show totals from the form'
subforms. The formula (in general names) is:

=IIf([Subform].[Form].[RecordsetClone].[RecordCount]>0,[Subform].[Form]![Total],0)

When I copy the DB to the user' computer, I get #Name?. The formula is
working, though, if I leave only [Subform].[Form]![Total], without using the
Iif function.

I've made sure that Windows Regional and Language Options are the same in
both computers (i.e. list separators, language for non-Unicode programs
etc.), so the syntax can't be a problem.

What else may I check in order to solve the problem?
 
M

Mishanya

Hi Allen.
My user has Access 2003 (most probably same version as mine).
In my comp I use RecordsetClone expression. Your tip uses Recordset. I
tested Recordset expression in my comp, and it still works (I don't really
know what is the difference between RecordsetClone and Recordset expressions).
On the contrary, in my user' comp, when having expression RecordsetClone
(wich did not work) changed to Recordset, I get msgbox:

"Access failed to evaluate one or more expressions because "Recordset" was
referenced in an expression. Only functions and properties that are
considered to be safe are allowed to be in expressions when Access runs in
Sandbox mode"

What do U think of that?



Is your user on Access 2007?

There's a bug in the new version where that expression doesn't work. See:
Avoid #Error in form/report with no records
at:
http://allenbrowne.com/RecordCountError.html

The article explains how to create a little wrapper function that does work
(assuming that they have the database in a trusted location.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mishanya said:
I have a few unbound text boxes in my form wich show totals from the form'
subforms. The formula (in general names) is:

=IIf([Subform].[Form].[RecordsetClone].[RecordCount]>0,[Subform].[Form]![Total],0)

When I copy the DB to the user' computer, I get #Name?. The formula is
working, though, if I leave only [Subform].[Form]![Total], without using
the
Iif function.

I've made sure that Windows Regional and Language Options are the same in
both computers (i.e. list separators, language for non-Unicode programs
etc.), so the syntax can't be a problem.

What else may I check in order to solve the problem?
 
M

Mishanya

Hi again!
After reading Your tip, changing RecordsetClone expression to Recordset and
getting an error msgbox, I've googgled on the msgbox content (about safety,
sandbox etc.) and found that it may be a safety issue.
I've changed Macro safety level to Low in my user' comp - and that made a
trick. Now the formuls works.
I hope, lowing the safety level is not punishible in my case, although maybe
it is better to have a way to deal with no-records-#errors without messing
with the safety?

Allen Browne said:
Is your user on Access 2007?

There's a bug in the new version where that expression doesn't work. See:
Avoid #Error in form/report with no records
at:
http://allenbrowne.com/RecordCountError.html

The article explains how to create a little wrapper function that does work
(assuming that they have the database in a trusted location.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mishanya said:
I have a few unbound text boxes in my form wich show totals from the form'
subforms. The formula (in general names) is:

=IIf([Subform].[Form].[RecordsetClone].[RecordCount]>0,[Subform].[Form]![Total],0)

When I copy the DB to the user' computer, I get #Name?. The formula is
working, though, if I leave only [Subform].[Form]![Total], without using
the
Iif function.

I've made sure that Windows Regional and Language Options are the same in
both computers (i.e. list separators, language for non-Unicode programs
etc.), so the syntax can't be a problem.

What else may I check in order to solve the problem?
 
T

Tom van Stiphout

On Tue, 9 Dec 2008 05:16:09 -0800, Mishanya

Alternatively you would digitally sign your database.

-Tom.
Microsoft Access MVP

Hi again!
After reading Your tip, changing RecordsetClone expression to Recordset and
getting an error msgbox, I've googgled on the msgbox content (about safety,
sandbox etc.) and found that it may be a safety issue.
I've changed Macro safety level to Low in my user' comp - and that made a
trick. Now the formuls works.
I hope, lowing the safety level is not punishible in my case, although maybe
it is better to have a way to deal with no-records-#errors without messing
with the safety?

Allen Browne said:
Is your user on Access 2007?

There's a bug in the new version where that expression doesn't work. See:
Avoid #Error in form/report with no records
at:
http://allenbrowne.com/RecordCountError.html

The article explains how to create a little wrapper function that does work
(assuming that they have the database in a trusted location.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mishanya said:
I have a few unbound text boxes in my form wich show totals from the form'
subforms. The formula (in general names) is:

=IIf([Subform].[Form].[RecordsetClone].[RecordCount]>0,[Subform].[Form]![Total],0)

When I copy the DB to the user' computer, I get #Name?. The formula is
working, though, if I leave only [Subform].[Form]![Total], without using
the
Iif function.

I've made sure that Windows Regional and Language Options are the same in
both computers (i.e. list separators, language for non-Unicode programs
etc.), so the syntax can't be a problem.

What else may I check in order to solve the problem?
 

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

Similar Threads


Top