I would like to have a field in my report whereby if one field is empty, information from another field is inserted as it has to be either one or the other.
I have tried - =IIf([RefNo] Is Null,[AdminRef])
All it seems to do is add in the AdminRef. Any help much appreciated. I'm sure I've done this before but cannot find or remember how!
18 1244
What you have done is told it what to do if RefNo is Null.
You haven't told it what to do if there is a valid RefNo. -
IIf(IsNull([RefNo]), [AdminRef],[RefNo])
-
Phil
NeoPa 32,557
Recognized Expert Moderator MVP
Phil, can more than one field be added or is it limited to two?
Yes, but you're not helping yourself by not stating whether this is a calculated field on your report, or whether it is the underlying query.
What specifically do you want to do?
Phil
NeoPa 32,557
Recognized Expert Moderator MVP
... and with fifty posts now you should be beyond half-considered posts that waste time Glat.
If you have multiple fields you want to present in the order of whichever is come across first shows, then with fields [A], [b], [C] & [D] you would use : - Nz([A],Nz([b],Nz([C],[D])))
Phil it is in an unbound text box in the report. It is not calculated.
Sorry NeoPa.
I tried your Nz option however all I kept getting was #Type in my text box.
Well, if it's not bound to a field in the report's underlying query, and it's not calculated, where is it getting any information from????
You have not answered my question "What specifically do you want to do?"
Phil
The report is based on a query of archived files. Different files have different references and file names; TenantRef, AdminRef; FileDesc, AdminName. I am trying to have all the file references in one text box and all the file names in another text box so the report can fit on a landscape A4 page.
OK, Glat
Can you post the SQL for the report's RecordSource
Phil
Hi Phil,its - SELECT [Archived Files].TenantRef, [Archived Files].From, [Archived Files].To, [Archived Files].Volumes, [Archived Files].FileNo, [Archived Files].Comments, [Archived Files].FileType, Property.PropertyRef, [Archived Files].Destroyed, Property.Town, Tenant.Company, Property.AddressLine1, Property.AddressLine2, Property.AddressLine3, Property.AddressLine4, Property.PostCode, Admin.AdminName, Admin.AdminRef, [Archived Files].FileDescription, [File List].FileListName, [Archived Files].Address, [Archived Files].Town, [File List].Ref
-
FROM [File List] RIGHT JOIN (Property RIGHT JOIN (Admin RIGHT JOIN (Tenant RIGHT JOIN [Archived Files] ON Tenant.TenantID = [Archived Files].TenantID) ON Admin.AdminRefID = [Archived Files].AdminRefID) ON Property.PropertyID = [Archived Files].PropertyID) ON [File List].FirstListNameID = [Archived Files].FileListID
-
ORDER BY [Archived Files].FileNo;
-
We're getting there very, very slowly.
Now all you need to tell me is what you want to see in your text box.
I think there are 2 options
1) "ABCDEF, HIJK, LMNOPQR" where ABCDEF represents TenantRef, HIJK represents AdminRef and LMNOPQR represents PropertyRef
2) If TenantRef is Null, Show AdminRef, but if both TenantRef and AdminRef are null, Show PropertyRef.
Am I close?
Phil
Phil, yes you are correct: if the TenantRef is Null, show FileListID, if both are Null then show AdminRef. The PropertyRef is a text box on its own.
We've got there !!!!!!!
So in your SQL, before the word "FROM" add -
IIf(Not IsNull(TenantRef), TenantRef, IIf(Not IsNull(FileListID), FileListID, Nz(AdminRef)))) AS Ref
-
Phil
Phil, sorry got caught up yesterday. Put in the SQL and receiving a message saying "Syntax error in FROM clause".
I have however put the code in an unbound text box as - =IIf(Not IsNull([TenantRef]),[TenantRef],IIf(Not IsNull([FileListID]),[FileListID],Nz([AdminRef])))
and it works perfectly.
I have also used same code in another unbound text box for other fields as well.
Thank you for all your help.
NeoPa 32,557
Recognized Expert Moderator MVP Glat:
I tried your Nz option however all I kept getting was #Type in my text box.
I must have missed this earlier.
I'm confident that using Nz() should both work and give you what you asked for. Can you post your exact attempt at following the suggestion. I suspect we may be able to help you resolve it. One thing to bear in mind using Nz() is that the type of value to use if Null is important in most cases.
Now I've caught up with the rest of the posts I can see you may not be interested in following up any longer. That's fine, but if you want to see it done with just Nz() , which would be quite sensible, then feel free to continue on.
I would guess you want something like : - =Nz([TenantRef],Nz([FileListID],Nz([AdminRef],'')))
If at least one of them is always guaranteed to be non-null then even : - =Nz([TenantRef],Nz([FileListID],[AdminRef]))
Neopa, somehow I did not receive your last reply. I tried your - =Nz([TenantRef],Nz([FileListID],Nz([AdminRef],'')))
and this one did work for me as well.
Thank you.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: BlackFireNova |
last post by:
This concerns an Access 2002 (XP) database. There are two fields,
"Notes" (Memo Field) and "Notes Update" on a form (among others)
which I am concerned with here.
Problem: I need to be able...
|
by: Greg |
last post by:
I am trying to change the value of one field in my query based on the value
in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the
date to change to today's date. Any help would...
|
by: geronimo_me |
last post by:
Hi,
I am atempting to compare part of a field with the whole of another
field in access. Is this possible?
Basically I have 2 tables with the following info:
Table1
Field1 = MR.
|
by: Bryan Warren via AccessMonster.com |
last post by:
I am creating a new database, that will contain 2 fields that will have the
same data. The DB is an inventory of computers. the fields I want to
duplicate are the "serial number" and the "computer...
|
by: Jan |
last post by:
Hi all,
I have got the following problem:
User fills in excel sheet, this is loaded in Acces.
After this I run a validation tool to validate the field formats.
One fields is allowed to be...
| |
by: MN |
last post by:
I am using a program called IDWorks which is reading and writing to an
MS Access format database. The IDWorks program can't adjust the
formatting on a displayed field in a way that we need so I...
|
by: Coll |
last post by:
I have a field that I would like to display on a report only if the
value of another field matches a certain criteria. If it does match I
need the label & the field value to display (though I'm...
|
by: martin DH |
last post by:
Hello,
In a report, for every record, I would like a checkbox to appear checked if a certain field contains any value.
The field is Client_comments. (memo field)
I added a checkbox called...
|
by: MyWaterloo |
last post by:
Ok.
I have a form with a field for a sampler's name, number, and email address. The sampler's name is selected from a combo box that references a table with name, number, and email. I want to be...
|
by: Fspinelli |
last post by:
Me again!
I am not sure how to phrase this, "but", I have to create a field that produces data in a specific format from other fields of data.
Creating the table and the query was the easy...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |