check box on form - getting it to default to a business vs. home address?

  • Thread starter Thread starter Michaela
  • Start date Start date
M

Michaela

Hi,
on my form I have contact info including business address
and residential address. (we send newsletters to our
members but some want them to go to the work address
others to the home address)

I created a check box on the form called send mail -
check business or residential but I can not figure out
the code to make it work.

I want all my reports and queries to default to the
address that corespondes to the check box that was
checked (residentail to residential address or business
to business address)

If anyone out there can emial me back it would be most
appreciated. I am ready to pull all thte hair out of my
head!ugh!

Thank you,
Michaela
 
Rather than a checkbox, use an option group with two options - Residential and
Business. Then use the value of the option group as criteria in a query to
determine which address to send to.
 
Hi,
on my form I have contact info including business address
and residential address. (we send newsletters to our
members but some want them to go to the work address
others to the home address)

I created a check box on the form called send mail -
check business or residential but I can not figure out
the code to make it work.

I want all my reports and queries to default to the
address that corespondes to the check box that was
checked (residentail to residential address or business
to business address)

If anyone out there can emial me back it would be most
appreciated. I am ready to pull all thte hair out of my
head!ugh!

Thank you,
Michaela

It doesn't do any good to have the check box just on the form, you
have to have the check box bound to a field in the table.

Add a check box field to your table.
Name the field MailHome

Then add the MailHome field to the form.

Now when you enter the addresses in the members table, check the box
if the member wants the letter sent to his home residence. Leave the
box unchecked for business mailing.

Create a query with all of the fields necessary for the news letter
mailing EXCEPT the Address fields.
Add a new column to the query grid.
MailAddress:IIf([MailHome]=-1,[HomeAddress],[BusinessAddress])

Make this query the letter report's record source.
Use the [MailAddress] field in the report.
 
Thank you for responding.

I changed the check box to the option group as suggested
however when I try to run the query - it does not work.

I used:
IIf(Forms!frmMember!Business=1,[Address],[HomeAddress]

The query runs but it gives me the home address even
though business has been checked off.

do you know what I am doing wrong?

Thanks
Michaela
 
-----Original Message-----
Rather than a checkbox, use an option group with two options - Residential and
Business. Then use the value of the option group as criteria in a query to
determine which address to send to.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com





.
 
Thank you for responding.

I used the option group as suggested but the query does
not work.

I used:

IIf(Forms!frmMember!Business=1,[address],[homeaddress]

But when the query runs I get the home address even
though business was checked.

do you know what I am doing wrong?

Thanks
Michaela
 
Michaela said:
I changed the check box to the option group as suggested
however when I try to run the query - it does not work.

I used:
IIf(Forms!frmMember!Business=1,[Address],[HomeAddress]

The query runs but it gives me the home address even
though business has been checked off.


That implies that the Business control on the form never has
a value of 1.

If the Business control is bound to a field in a table, open
the table and check the field to see what values are really
there.

If Business is an unbound control check each option
OptionValue to see what values are actually being set.
 
Back
Top