AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Multiple if statements

Using MS Access - Multiple if statements


Expert: Scottgem - 2/23/2005

Question
I created a database in access to track vehicle mileage. One field has users enter a department number. I need to show in my report which agency the department falls under. Is there a way to write a if,then type statement to automatically assign an agency number to each department. I have 590 departments in 31 agencies. I was trying to use =IIf([Department #]=800,1) {1 is the agency #} but I cant seem to figure out how to add more department #'s if that is even possible.
Thanks for your help
B

Answer
You need more tables. You need An Agency table and you need to an Agency field in your departments table.

tblAgencies
AgencyID (Primary key-Autonumber)
AgencyName

tblDepartments
DepartmentID (PK Autonumber)
DepartmentName
AgencyID (Foreign key to tblAgencies)

With that structure you can join your tables to get Agency Name for reporting purposes.

HTH
Scott<>

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.