Check Box

  • Thread starter Thread starter Cory Sullivan
  • Start date Start date
C

Cory Sullivan

I have a form that contains client information then a subform that contains
project specific information.

In the project subform I have contact information specific to that project
this may or may not be the Client.

I would like to have a check box beside the contact info that states "same
as Client" and if the box is checked the contact info is filled with the
clients name and address. And if left unchecked remains empty.

any suggestions are appreciated.

Cory
 
Cory,

You have the checkbox on your main form. The name of
that checkbox is needed to use in a query of the subform
that you are referring to. Also, you must have a common
field between the Client and the Project tables (you
probably know whatever that is).What you want to do is
place a query which holds the contact information as the
source of your subform (unless you already have). After
placing the fields that you are interested in in the
query, plus the common field, place the following in the
field of the query which is common to both the Client form
and your Contacts subform:

iif([forms].[mainform].[checkbox] = true, [forms].
[mainform].[clientname], null)

but instead of using the [mainform] use the name of
your main form, instead of using [checkbox] use the name
of your checkbox on your main form, instead of using
[clientname] use the name of the text box from your main
form that use the field source that is common to both the
Client and Project tables (the one that is common to the
field that you placed the criteria for in the query).

What the statement above is saying is that if the
checkbox is checked (true), then use the information of
the Client field that is on your form to filter out
records, else if the checkbox is not checked, then just
use "Null" as the filtering factor for the field of the
query.

You may be able to use a variation of what I have
shown you for your situation. Anyway, that is sort of a
basis.

Casey
 
Thanks I will give it a try


Casey said:
Cory,

You have the checkbox on your main form. The name of
that checkbox is needed to use in a query of the subform
that you are referring to. Also, you must have a common
field between the Client and the Project tables (you
probably know whatever that is).What you want to do is
place a query which holds the contact information as the
source of your subform (unless you already have). After
placing the fields that you are interested in in the
query, plus the common field, place the following in the
field of the query which is common to both the Client form
and your Contacts subform:

iif([forms].[mainform].[checkbox] = true, [forms].
[mainform].[clientname], null)

but instead of using the [mainform] use the name of
your main form, instead of using [checkbox] use the name
of your checkbox on your main form, instead of using
[clientname] use the name of the text box from your main
form that use the field source that is common to both the
Client and Project tables (the one that is common to the
field that you placed the criteria for in the query).

What the statement above is saying is that if the
checkbox is checked (true), then use the information of
the Client field that is on your form to filter out
records, else if the checkbox is not checked, then just
use "Null" as the filtering factor for the field of the
query.

You may be able to use a variation of what I have
shown you for your situation. Anyway, that is sort of a
basis.

Casey
-----Original Message-----
I have a form that contains client information then a subform that contains
project specific information.

In the project subform I have contact information specific to that project
this may or may not be the Client.

I would like to have a check box beside the contact info that states "same
as Client" and if the box is checked the contact info is filled with the
clients name and address. And if left unchecked remains empty.

any suggestions are appreciated.

Cory





.
 
Back
Top