Results 1 to 3 of 3
  1. #1
    KBNETGUY is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    26

    Shipping Address and Billing Same Button

    I have a form page that includes a section for adding Shipping Address and Billing Address.
    I would like to create a procedure that when a button is pressed then the data entered into the Shipping address gets copied into the Billing Address fields.

    Similar to whats typically on websites so that a user can save time having to enter the information twice. NOTE: I still need the data entered in both places so having the copy procedure would save time from having to enter it twice.

    Any help would be great.

  2. #2
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    Assuming you have a form with the following text boxes;

    txtShippingaddress
    txtShippingCity
    txtShippingState (or Province, Region, etc)
    txtShippingPostalCode
    txtShippingCountry

    txtBillingaddress
    txtBillingCity
    txtBillingState
    txtBillingPostalCode
    txtBillingCountry

    Then you would use a command button with code like the following;

    Code:
    Private Sub cmdYourButton_Click
    
    With Me
    
       !txtBillingAddress = !txtShippingAddress
       !txtBillingCity = !txtShippingCity
       !txtBillingState = !txtShippingState
       !txtBillingPostalCode = !txtShippingPostalCode
       !txtBillingCountry = !txtShippingCountry
    
    End With
    
    End Sub
    You may also want to add a way to undo the copy in case of mistakes.

  3. #3
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    You may also want to add a way to undo the copy in case of mistakes.
    Such as on click, first check the button caption. If it is like "Copy Shipping Address to Billing" then do the copy and change the caption as in "Delete Billing Address Info". A subsequent click finds the caption to not be "Copy..." so you set the second group of address controls to "". There are other controls you could use as well, such as an option or toggle button, though I'd favor the toggle last I think. Then you'd alter a label instead of a button caption based on whether the option value is true or false (-1 or 0).
    Last edited by Micron; 03-30-2018 at 06:58 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. adding multiple shipping address to a customer ID
    By joecamel9166 in forum Forms
    Replies: 6
    Last Post: 03-29-2016, 07:27 AM
  2. Check box - "Same as billing address"
    By brettnolan in forum Access
    Replies: 2
    Last Post: 04-24-2014, 08:46 PM
  3. Replies: 2
    Last Post: 08-22-2013, 12:02 AM
  4. Replies: 4
    Last Post: 01-13-2013, 02:40 AM
  5. Replies: 4
    Last Post: 04-14-2012, 07:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums