checkbox address help!

D

d9pierce

Hi all,

I need some design help with a check box / vb code.

I have a form called Company_Main which gives the basic information of
company. The address, city, state, and Zip comes from tbl_Address.
Address is txt, Zip is a cbo from tbl_Cities and city and state are
txt from that tbl.

Some of my company(s) have a remitence address so what I am trying to
accomplish is that if chkbx=true, then this is the same address as
primary, else one selects a different address by typing in the address
and selecting zip for the zip, city, and state to be remitted to.

I am assuming the best way to accomplish this is to use a subform on
my form for the remitence address?

The major delima I have is how to make changes in this for example:
Lets say the remitence address is the primary address and then the
company grows and now I need to change the remitence address to
something other then the primary so I would uncheck this chkbx and add
a remitence address or viseversa, a company downsizes and then I need
to make the companys primary address the remitence.

My thoughts are to have in my tbl_Address a check for primary, check
for remitence, and a check for primary remit as well as the other
fields?

Not real sure how to accomplish this and not end up with a ton of
errors in doing so!

could anyone share some insite with em on this please.
Thanks,
Dave (e-mail address removed)
 
M

Mr B

I normally handle this situation by having a Yes/No field to indicate that
the primary address is the same as the remittance address (using your
terminology). This field would be defaulted to Yes for all new records,
unless changed by the user. I got the impresstion from your posting that you
have a seperate table for the addresses. I would think that unless you have
some extinuating circumstance requiring a seperate table, the addresses can
and would be in the same table as the other infor about the company.

I use the After Update event of the address field to run code to determine
the status of the Yes/No field. If it is still yes, then I have my code to
update/populate the address field for remittance with the same address. If
the Yes/No field is set to no, nothing is writen to any other other fields.
In your case then you would also perform the same check after the zip code
has been selected and if the Yes/No field is yes then write to the
appropriate remittance field, otherwise do not write, just allow the user to
specify the new address information.

I will at times also show or hide the second address information based on
the value of the Yes/No field. To do this would require code in the
OnCurrent event of your form and code in the AfterUpdate event of your check
box.


--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 

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