Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Can Checkbox return any other value ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pat Coleman - 22 Mar 2008 17:17 GMT
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 ??
Albert D. Kallal - 23 Mar 2008 00:20 GMT
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.

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

Pat Coleman - 24 Mar 2008 13:15 GMT
Thanks - I will give it a whirl

Pat
> Well, if you normalize you data design, then you could also add a child
> table
[quoted text clipped - 57 lines]
> suggestion will allow you to use your current database without
> modifications to the tables.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.