I have two Yes/No fields in a table (ContractorInstall, andInHouseInstall)


T

Tara Metzger

I have two Yes/No fields in a table (ContractorInstall and InHouseInstall) What I would like to happen in the form is as follows: Since one of the boxes must be checked (yes), the checked box will display either the contractor or the in-house survey depending upon which one is "yes". If it's a contractor install, the contractor survey needs to be displayed. The inhouse survey is to be hidden either from view or seen but blocked from data entry, and vice versa. My question is this. Am I better trying to set this up in the form itself or should I use queries to help?
Thank you,
Tara


Submitted via EggHeadCafe - Software Developer Portal of Choice
Silverlight, WCF, Security And Things You Might Not Know
http://www.eggheadcafe.com/tutorial...882-f6ac833492d5/silverlight-wcf-securit.aspx
 
Ad

Advertisements

J

Jeanette Cunningham

Setting up Yes/No fields for this is better avoided.
Create a table for InstallType.
tblInstallType
InstallTypeID - autonumber- Primary Key
InstallTypeName - description of the type

In the main table, put InstallTypeID as one of the fields.
In the relationships window with both the main table and the install type
table,
select InstallTypeID from tblInstallType and drag it onto the matching field
in the main table.

In the data entry screen you will have a field for the InstallTypeID. Make
this a combo.
The combo's row source will be a query based on tblInstallType.

So on the data entry screen, in the after update of the combo you can go
If Me.NameOfCombo = 1 Then
'contractor, code to display the contractor survey
Else
'code to display the in house survey
End If

The above assumes that 1 is the InstallTypeID for a contractor install.
You will use the value from your InstallType table.

You can also change the above slightly and make the InstallTypeID in the
table a text field and make it the primary key.
Doing it this way means you only need one field in the table and the values
for InstallTypeID would be Contractor, and the next row would be Inhouse.
It's up to you which way you do it.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

John W. Vinson

I have two Yes/No fields in a table (ContractorInstall and InHouseInstall)

That's not an ideal design: I presume that if one is checked the other should
not be? You wouldn't have a record where neither was checked, or both were
checked, would you?

If that is the case, I'd suggest using *one* field, Installer; it would be
convenient to have this a Number/Integer field, and use an Option Group
control on the form. This would let you store a 1 for Contractor, 2 for
InHouse (and perhaps in the future 3 for Preinstalled and 4 for Customer
Installed, if those options should come to pass); the Option Group would have
two (or more) radio buttons with labels.
 
Ad

Advertisements

T

Tara Metzger

Jeanette, thank you for your help. I thought of doing it the way you suggested initially, but talked myself out of it. Guess I should have trusted my instincts on this one. :) I will go with what you suggest. It looks like a much better way of doing it.
Thank you,
Tara



Jeanette Cunningham wrote:

Setting up Yes/No fields for this is better avoided.
27-Jan-10

Setting up Yes/No fields for this is better avoided
Create a table for InstallType
tblInstallTyp
InstallTypeID - autonumber- Primary Ke
InstallTypeName - description of the typ

In the main table, put InstallTypeID as one of the fields
In the relationships window with both the main table and the install typ
table
select InstallTypeID from tblInstallType and drag it onto the matching fiel
in the main table

In the data entry screen you will have a field for the InstallTypeID. Mak
this a combo
The combo's row source will be a query based on tblInstallType

So on the data entry screen, in the after update of the combo you can g
If Me.NameOfCombo = 1 The
'contractor, code to display the contractor surve
Els
'code to display the in house surve
End I

The above assumes that 1 is the InstallTypeID for a contractor install
You will use the value from your InstallType table

You can also change the above slightly and make the InstallTypeID in th
table a text field and make it the primary key
Doing it this way means you only need one field in the table and the value
for InstallTypeID would be Contractor, and the next row would be Inhouse
it is up to you which way you do it

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Content Director Test Article
http://www.eggheadcafe.com/tutorial...f-e92ac7a4593f/content-director-test-art.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top