If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Can Checkbox return any other value ?
I have a form that runs a 'Customer Address' query.
One Field in the query has address type ( Billing , Shipping etc .. ) I was tring to figure out if I could have on my form which a checkbox called "billing" and another called "Shipping" and if the check box was checked the query would return that address, or both. True and False wont work as the address types have different names in the same field. Am I making sense ?? |
#2
|
|||
|
|||
Can Checkbox return any other value ?
Well, if you normalize you data design, then you could also add a child
table of address, the you could go: Any Address Type [] include in mailing address fields... Lake Address [] include in mailing address fields... Summer Address [] include in mailing address fields... Shipping Address [] include in mailing address fields... Billing Address [] include in mailing address fields... So, if you add a child table called tblCustomerAddress, then you could check the above [x] include in mailing check box, and you thus would build a query that returns ONLY address with a checked box. The beauty of such a normalized design is you can add as many address as you wish, and you would not be restricted to just 2 address. And, you can VERY Easily extend the design to include things like shipping instructions for particular different locations. The beauty of a normalized design if you decide to add shipping instructions, you instantly have that feature for all the addresses you use above. Since you have a non-normalized design, you *could* consider creating a query that is a join back to the same table. You would also have to make that new query set the address fields in both cases to a "common" set of names for the address part. eg: qryShipAdd custID shipCheckBox as shipFlag shipaddress as address, shipcity as City etc. Now, do the above SAME thing for billing address, (again making using "as fieldname" to make all fields with the same name for address collums. (don't forget the condition = true for the shipcheckbox/billingcheckbox) Now, make a union all query of both the above queries. Now, create a another query that includes the main table (fields such as date, phonenumber, etc), and you *left* join in the new union query on custID to get the address fields. I suppose you could skip the need for this query if you included *all* the fields you need in the above two queries (as opposed to JUST including the address fields + flag + custID). Regardless, the resulting query will return either address depending on which check box is checked (and, if both are checked, then both address will appear in the query. So, if you don't want to normalize your data, you can use the above query idea to reach the same goal of using a checkbox to select what address. If you have the time, it is better to normalize your database. However, the second suggestion will allow you to use your current database without modifications to the tables. -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
#3
|
|||
|
|||
Can Checkbox return any other value ?
Thanks - I will give it a whirl
Pat "Albert D. Kallal" wrote in message ... Well, if you normalize you data design, then you could also add a child table of address, the you could go: Any Address Type [] include in mailing address fields... Lake Address [] include in mailing address fields... Summer Address [] include in mailing address fields... Shipping Address [] include in mailing address fields... Billing Address [] include in mailing address fields... So, if you add a child table called tblCustomerAddress, then you could check the above [x] include in mailing check box, and you thus would build a query that returns ONLY address with a checked box. The beauty of such a normalized design is you can add as many address as you wish, and you would not be restricted to just 2 address. And, you can VERY Easily extend the design to include things like shipping instructions for particular different locations. The beauty of a normalized design if you decide to add shipping instructions, you instantly have that feature for all the addresses you use above. Since you have a non-normalized design, you *could* consider creating a query that is a join back to the same table. You would also have to make that new query set the address fields in both cases to a "common" set of names for the address part. eg: qryShipAdd custID shipCheckBox as shipFlag shipaddress as address, shipcity as City etc. Now, do the above SAME thing for billing address, (again making using "as fieldname" to make all fields with the same name for address collums. (don't forget the condition = true for the shipcheckbox/billingcheckbox) Now, make a union all query of both the above queries. Now, create a another query that includes the main table (fields such as date, phonenumber, etc), and you *left* join in the new union query on custID to get the address fields. I suppose you could skip the need for this query if you included *all* the fields you need in the above two queries (as opposed to JUST including the address fields + flag + custID). Regardless, the resulting query will return either address depending on which check box is checked (and, if both are checked, then both address will appear in the query. So, if you don't want to normalize your data, you can use the above query idea to reach the same goal of using a checkbox to select what address. If you have the time, it is better to normalize your database. However, the second suggestion will allow you to use your current database without modifications to the tables. -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
Thread Tools | |
Display Modes | |
|
|