AndyCabbages
Registered User.
- Local time
- Today, 13:48
- Joined
- Feb 15, 2010
- Messages
- 74
Hey, I am having some trouble with an Iif statement. My current one works but it is massive, and impracticle.
Here is the problem:
The Iif statement is supposed to generate an address depending on which department creates the invoice (one department is in Slough, and the other is in London, but they both use the system).
Currently the Names of the users of the system are stored in a 'Users' table. This table contains the fields: 'Name' and 'Location'.
The form which generates the report has a drop down menu labeled: 'Prepared By' which looks up 'Users.Name'. This then saves the selection in an 'Invoice' table under the field name 'PreparedBy'
This 'Prepared By' value is stored as a name (E.G. 'John Smith') which is displayed on the report.
There is only a total of 5 users at the moment, with 3 in the Slough department and 2 in the London department, but future users might be added.
Currently the way the Iif statement is set up like:
Iif Prepare By = (Names of the Slough Department) then (Slough address) else (London Address).
This is very impracticle, first of all becuase the Iif statement is massive, and second of all because there is absolutely no room for expansion, if anyone gets added to the userlist then the whole statement has to be re-written.
What I am looking to do is somehow select both the user's name AND location and store them both in the 'PreparedBy' field. Then somehow write the Iif statement as something more like:
Iif PreparedBy (Location) = Slough do Slough address, else do London Address.
I have not been able to find any way of selecting both the User's name and location when adding a value to the 'PreparedBy' field or any way of representing this in the Iif statement. I am wondering if there is any way to do this? I hope my explaination is understandable
Here is the problem:
The Iif statement is supposed to generate an address depending on which department creates the invoice (one department is in Slough, and the other is in London, but they both use the system).
Currently the Names of the users of the system are stored in a 'Users' table. This table contains the fields: 'Name' and 'Location'.
The form which generates the report has a drop down menu labeled: 'Prepared By' which looks up 'Users.Name'. This then saves the selection in an 'Invoice' table under the field name 'PreparedBy'
This 'Prepared By' value is stored as a name (E.G. 'John Smith') which is displayed on the report.
There is only a total of 5 users at the moment, with 3 in the Slough department and 2 in the London department, but future users might be added.
Currently the way the Iif statement is set up like:
Iif Prepare By = (Names of the Slough Department) then (Slough address) else (London Address).
This is very impracticle, first of all becuase the Iif statement is massive, and second of all because there is absolutely no room for expansion, if anyone gets added to the userlist then the whole statement has to be re-written.
What I am looking to do is somehow select both the user's name AND location and store them both in the 'PreparedBy' field. Then somehow write the Iif statement as something more like:
Iif PreparedBy (Location) = Slough do Slough address, else do London Address.
I have not been able to find any way of selecting both the User's name and location when adding a value to the 'PreparedBy' field or any way of representing this in the Iif statement. I am wondering if there is any way to do this? I hope my explaination is understandable