error in a query

rowantrimmer

New member
Local time
Today, 22:20
Joined
Apr 16, 2004
Messages
9
I have the following in the criteria for the surname field...

=IIf(IsNull([surname])," ",[surname])

but I get the following error......

Compile error in query expression.

Any ideas ?
 
See my reply to your other post.
It is not the criteria you want to change, it is the way you define the field in the query.
 
Help

TessB said:
See my reply to your other post.
It is not the criteria you want to change, it is the way you define the field in the query.

What I have got is a field called surname. If it is null I want to ouput a " "

Can you help ?
 
See your other post.
I know you are brand new so you are entitled to a faux pas.... :D
In the future, just use one post for all your related questions. It saves everyone from having to answer the same type of question on several posts.
Thanks!
Tess
 
Sorry about that

TessB said:
See your other post.
I know you are brand new so you are entitled to a faux pas.... :D
In the future, just use one post for all your related questions. It saves everyone from having to answer the same type of question on several posts.
Thanks!
Tess

Perhaps I could explain what I am trying to do. I am trying to export data into an xml file through a query. The problem that I am having is that if say the surname field is left blank the xml tag does not get output. I need to force say a blank into the field so that the xml tag will be output.

Can you help me please !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Okay, we are not going to touch the criteria field... we are defining the data you need in the query. In the field definition area, where you would normally just choose Surname or EmpNo or any other field, type this:

Surname: IIF([Surname] is Null Or [Surname] like "", "Surname N/A", [Surname])

You could also have it print whatever you like instead of Surname N/A.
 
Last edited:
Fantastic

TessB said:
Okay, we are not going to touch the criteria field... we are defining the data you need in the query. In the field definition area, where you would normally just choose Surname or EmpNo or any other field, type this:

Surname: IIF([Surname] is Null Or [Surname] like "", "Surname N/A", [Surname])

You could also have it print whatever you like instead of Surname N/A.

That is great. Just one thing though the tag doesn't say surname but expr1 as pasted below. Is there anything I can do about that ???

<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2004-04-23T18:10:01">
- <person>
<forename>rowan</forename>
<Expr1>trimmer</Expr1>
</person>
- <person>
<forename>jason</forename>
<Expr1 />
</person>
</dataroot>
 
Yes, it is because you did not remove the original field of Surname. If you have fields in a query with duplicate names, it renames them Exp1. So remove the original field.
 

Users who are viewing this thread

Back
Top Bottom