UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> #Name? error with IIF function    
 
   
ktillman
post Jan 30 2010, 02:53 PM
Post#1



Posts: 2
Joined: 30-January 10



I have set up an IIF function in a cell in one of my forms. I keep getting the error message #Name? on the form. I can't figure out where I'm going wrong. Below is the formula that is resulting in the error:
IIf([Destination Name]=[Forms]![Accomodations]![Riding Area/Trail],[Forms]![Accomodations]![Property Name],"NA")
Please let me know if you have any suggestions.
Thanks.
Go to the top of the page
 
Alan_G
post Jan 30 2010, 03:06 PM
Post#2


Remembered as Utterly Yorkshire and Forum/Wiki Editor
Posts: 16,533
Joined: 12-January 03
From: Devon UK


Hi

Welcome to UA smile.gif

Is the form called Accomodations open when whatever form you have your expression in is also open ?

Plus, a tip for you - it's not a good idea to include spaces or special characters in naming anything so you may be better off renaming Property Name to PropertyName, Destination Name to DestinationName and Riding Area/Trail to RidingAreaTrail. It would more than likely save you a lot of head aches and hard to track down bugs/errors at some point wink.gif
Go to the top of the page
 
ktillman
post Jan 30 2010, 05:07 PM
Post#3



Posts: 2
Joined: 30-January 10



Thanks, Alan.
Yes, both forms are open at the same time.
Otook your advice and modified the names on the forms so that they do not include any special characters.
I still can't seem to figure out how to get this function to work properly. Any more suggestions would be great.
Thanks! thanks.gif
Go to the top of the page
 
Alan_G
post Jan 30 2010, 05:18 PM
Post#4


Remembered as Utterly Yorkshire and Forum/Wiki Editor
Posts: 16,533
Joined: 12-January 03
From: Devon UK


Hi
The #Name error suggests that Access can't find one of the fields/controls - don't know what you've renamed them to but using your original names either Destination Name, Property Name or Riding Area/Trail.
Have you removed the spaces from the names as well?
Ocan't see anything wrong with your expression, so try checking your spelling, make sure that all the fields/controls that are being used in your expression are in the underlying record source of the table(s) or on the form(s) in question.
Go to the top of the page
 
GroverParkGeorge
post Jan 30 2010, 05:20 PM
Post#5


UA Admin
Posts: 35,016
Joined: 20-June 02
From: Newcastle, WA


PMFJJI:
Is [DestinationName] (without the space as Alan has suggested) the name of a field in the table to which the form is bound, or a control on the form? And is the field in the table bound to that control? In this case, I assume that "DestinationName" is a field in the table and that it is also bound to a control on the form.
It seems to me that Access 2007 is more picky than previous versions in requiring the field to which an expression refers must be physically implemented on the form.
George
Go to the top of the page
 
Steve Schapel
post Jan 30 2010, 05:34 PM
Post#6


UtterAccess VIP
Posts: 3,881
Joined: 5-January 07
From: New Zealand


Ktillman,
The other thing to look for is the Name of the control (not "cell"!) where you have this IIf() expression. Assume it is a textbox. The name of the textbox is not allowed to be the same as the name of any field in the form's underlying Record Source table/query.
Go to the top of the page
 
tcrank472
post Apr 20 2011, 12:57 PM
Post#7



Posts: 110
Joined: 14-January 11



I am having the same problem with a #Name? error on a Form that shows my projects in a list view.
I have a text box field with the formula: =IIf(IsNull([ID]),"(New)","Open"). If the result is "Open" a user can click on the "Open" link and it runs a macro that opens a detail form.
It was working fine for a while, then all of a sudden, I got the #Name? in that field when I opened the form.
One time, I used the "Refresh" button and that cleared the error and the formula worked again. Now however when use the Refresh menu command I get prompted for: "Enter Parameter Value: Application.CurrentObjectName and a field to make an entry and the OK/Cancel buttons.
Today, I changed the name of the text box and that worked restored the functionality of the formula temporarily, everything was fine until I closed the database. When I reopened the database, I am back to the #Name? error in this field.
Runnning a C/R has no effect.
I am not a programmer, I just built an application around the Tasks sample database. Thanks for any help, I am stuck.
Access 2010
Windows XP Pro
IE ver 8
Go to the top of the page
 
tcrank472
post May 15 2011, 05:58 PM
Post#8



Posts: 110
Joined: 14-January 11



Changing the name of the text box solved the problem!
Thanks.
Go to the top of the page
 
Generalzod580
post Dec 28 2018, 08:07 AM
Post#9



Posts: 1
Joined: 28-December 18



The main way to solve the #Name? Error like in my case is to go to the properties of your form and change the record selectors and navigation buttons to be set to yes. You can do this by carrying out the following steps:
1 going to design view of your form
2 click the grey part to the right of your form to select your form
3 click on design tab at the top of your access banner and select property sheet
4 Under Format tab in property sheet look for record selectors and navigation buttons
5 set them both to yes. This should solve the #Name? Error for your IIf function.

Also make sure that the form or report or field or name of textbox that your IIf function is referring to is exactly the same name given to that report or form or field or textbox being referred too

Please if this works reply.
If there are any corrections feel free to add them so we can all learn I'm not perfect this is simply what worked for me.

Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th May 2019 - 03:03 AM