Access Newbie! In Access table how do you get field 2 to display data dependant on option selected in field?
Scenario posed: In Access, you have a table with two fields, 1st field is "Call" and has 2 options (drop down list) 1) Phone during office hours, and 2) Phone out of office hours
2nd field is "Number" and has 2 telephone numbers as options (drop down list)
Is it possible on the basis of the option chosen in field one, to force field 2 to display the corresponding telephone number ie either the office or home number?
Would this be done in a separate query with an IF statement or calculated field or something along those lines?
Can anyone make sense of what is trying to be achieved? Any help gratefully received!
- Ben BeitlerLv 410 years agoBest Answer
Access Newbie! In Access table how do you get field 2 to display data dependent on option selected in field?
There are several approaches to this and it will depend on what you intend to do with the second field (later on).
If you want to just show it based on the drop-down of the first field, use a simple expression (probably an IIF will do the job).
For example, Field1 is called [Field1] in the the second field you would write something like...
= IIF ( [Field1] = "Phone during office hours" , "0123456789" , "9876543210" )
I personally would use a table with two fields (one for the narrative and the second one for the phone number) and display both in the same drop-down box. You can then use a simple expression to refer to the first drop-down box's second column by using the 'Column' property (see Access help on drop-down lists and 'Column' property).
Hope this helped.
Ben BeitlerSource(s): Expert Access database developer, Excel spreadsheet and VBA programmer. http://www.about-access-databases.com http://www.access-database.com http://www.excel-spreadsheet.com http://www.trainingpartnership.biz
- 10 years ago