Autofill Addresses

  • Thread starter Tammy Jardine via AccessMonster.com
  • Start date
T

Tammy Jardine via AccessMonster.com

In a form, I had two fields. One for billing address and one for shipping
address. I wanted the shipping address to automatically fill in exactly what
I entered into the billing address field. To do this, I put the control
source, BillingAddress, into the Shipping Address field (in the form itself).
It worked. But now, how can I have the shipping address automatically fill
when entering the billing address in a table?
 
R

Rick B

putting the control source as you did means that you are simply displaying
the same field twice. What if the two addresses are different? I bet if
you change one it changes both.

Instead, build code in your ON EXIT event for the billing address that
simply says...

If [shippingaddress]="" then
[shippingaddress]=[billingaddress].value
end if


This will look at shipping and if it is blank will copy the value in the
billing field.

Typically, you would not go the other way, but I guess you could put similar
code in the other field.
 
J

John Vinson

In a form, I had two fields. One for billing address and one for shipping
address. I wanted the shipping address to automatically fill in exactly what
I entered into the billing address field. To do this, I put the control
source, BillingAddress, into the Shipping Address field (in the form itself).
It worked. But now, how can I have the shipping address automatically fill
when entering the billing address in a table?

You can use some simple VBA code in the AfterUpdate event of the
billing address:

Private Sub txtBillingAddr_AfterUpdate()
If IsNull(Me!txtShippingAddr) Then ' don't stomp on existing data
Me!txtShippingAddr = Me!txtBillingAddr
End If
End Sub

John W. Vinson[MVP]
 

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