Populate Results From Several Selections (1 Viewer)

Chespirito

New member
Local time
Today, 11:08
Joined
May 3, 2020
Messages
24
Hello, I need some help with the following situation. I need to display the results from a number of selections to a text box if some selections are made.
I have included a demo DB as a sample. I have about 7 lines with 4 options each. Example: Heat = Natural Gas, Electric, Oil, Propane and a drop down box = Tenant/Landlord. so if I select a check box electric and paid by Landlord. I would like to display: Landlord Pay for Electric Heat and so on and so forth.
I am using a function = =IIf([NaturalGas]=True And [Paidby]="T","Tenant pays for propane heat") but it only works for the first line and when i try to nest more functions it does not work. I am not sure if there is a better way to do it. Thank you for your help in advance.
 

Attachments

  • DemoDB.accdb
    832 KB · Views: 90

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:08
Joined
May 7, 2009
Messages
19,246
try your demo db.
 

Attachments

  • DemoDB.zip
    46.1 KB · Views: 103

plog

Banishment Pending
Local time
Today, 10:08
Joined
May 11, 2011
Messages
11,669
You are not storing your data correctly. You have used data values as field names. Instead those field names need to go into a new table as data values. Let's call this new table tblUtilites. It's structure will be this:

tblUtilities
utl_ID, autonumber, primary key
ID_Tenant, number, foreign key to Tenants table
utl_Group, short text, this will determine if its for Cooking or Heating
utl_Type, short text, this will be the value which is currently a field name (eg. Propae, Oil, etc.)
utl_Payor, short text, this will dtermine who pays for it

That's it, those 4 fields will hold all your existing utility data and if you ever need more will do that too without adding new fields.

Then, when you want to create a string that displays what utilities the tenant and the landlord pay you would use the ConcatRelated function:

 

isladogs

MVP / VIP
Local time
Today, 16:08
Joined
Jan 14, 2017
Messages
18,261
For info, I moved this thread from sample databases which is a moderated area not intended for questions and approved all replies that had been made
 

Chespirito

New member
Local time
Today, 11:08
Joined
May 3, 2020
Messages
24
You are not storing your data correctly. You have used data values as field names. Instead those field names need to go into a new table as data values. Let's call this new table tblUtilites. It's structure will be this:

tblUtilities
utl_ID, autonumber, primary key
ID_Tenant, number, foreign key to Tenants table
utl_Group, short text, this will determine if its for Cooking or Heating
utl_Type, short text, this will be the value which is currently a field name (eg. Propae, Oil, etc.)
utl_Payor, short text, this will dtermine who pays for it

That's it, those 4 fields will hold all your existing utility data and if you ever need more will do that too without adding new fields.

Then, when you want to create a string that displays what utilities the tenant and the landlord pay you would use the ConcatRelated function:

Thank you for your well observed suggestion. I will follow your advise.
 

Users who are viewing this thread

Top Bottom