Check Box to populate Shipping address controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form for customer information. The table has billing address and
shipping address information. What steps do I take with a check box if
checked to populate the shipping address information with billing address
information.
 
In the AfterUpdate event of the checkbox:

Sub chkMyCheckBox_AfterUpdate()
If Me.chkMyCheckBox = True Then
Me.txtShipToAddress = Me.txtBillToAddress
Me.txtShipToCity = Me.txtBillToCity
Me.txtShipToState = Me.txtBillToState
Me.txtShipToZip = Me.txtBillToZip
Else
Me.txtShipToAddress = ""
Me.txtShipToCity = ""
Me.txtShipToState = ""
Me.txtShipToZip = ""
End If
End Sub
 
I have a form for customer information. The table has billing address and
shipping address information. What steps do I take with a check box if
checked to populate the shipping address information with billing address
information.

Use the checkbox's AfterUpdate event:

Private Sub chkDupAddress_AfterUpdate
If Me.chkDupAddress Then 'did the user check it True?
Me.txtShippingAddress1 = Me.txtBillingAddress1
Me.txtShippingAddress2 = Me.txtBillingAddress2
Me.txtShippingCity = Me.txtBillingCity
<etc>
End If
End Sub


John W. Vinson[MVP]
 
This code affects all records though. Do I need to requery at some point?

Eh?

It only affects all records if the ShipTo fields are unbound. Are you
trying to "store" them in the Form? or do you have fields for them in
your table?

John W. Vinson[MVP]
 
my record source for the form is a select query.

Please post the SQL of the query, the code you're using, and the
Control Source properties of the shipping address controls on the
form.

John W. Vinson[MVP]
 
SELECT Customers.CustomerID, Customers.CompanyName, Customers.FirstName,
Customers.LastName, Customers.BillingAddress, Customers.City,
Customers.StateOrProvince, Customers.ZIPCode, Customers.CompanyWebsite,
Customers.PhoneNumber, Customers.FaxNumber, Customers.ShipAddress,
Customers.ShipCity, Customers.ShipStateOrProvince, Customers.ShipZIPCode,
Customers.ShipPhoneNumber, Customers.Notes, Customers.Email,
Customers.ShipSame
FROM Customers;

Control Source of ShipAddress: ShipAddress
 
You posted the SQL. Thanks. Please read the rest of the sentence.

I'll be glad to help if you will cooperate.

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

Back
Top