Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2013
    Posts
    4

    Unanswered: Dealing with addresses

    Creating a database where the customer can have a home and a site address but these are mostly the same. How do I go about copying the home address into the site address fields? Have looked everywhere and find nothing. Look forward to the discussion. Cheers

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    Include a check box on your form with a label "Site address same and Home Address?".
    When the check box is a tick Yes, then use code to populate the site address with the home address.

  3. #3
    Join Date
    Sep 2013
    Posts
    4
    Thanks for the reply.
    I have hit a wall in trying to make a macro to do this and searched everywhere for something similar for no return. Not overly experienced in this area but basically I have tried to create a macro onClick with IF statements Address = S_Address but keep getting Access telling it can't find "Address" etc.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Personally I wouldn't copy addresses
    Id set a boolean column that identifies if the site address is the same as the home address

    then when ever I needed a site address I'd then use the home address if that boolean flag indicates there is no site address

    the main reason
    you are not duplicating data, one of the cardinal rules in relational db design

    it also makes the data capture form easier. you odn't have to overwrite other data.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Aug 2006
    Posts
    126
    Although Healdem has a good point about not duplicating data, in this case I prefer it because sometimes the differences between the two series of fields is minor.
    What I just did in a similar form was to show the fields of each address to the left and right of an action button. On pressing the action button, every field to the left is copied into the similar field on the right. This allows the user to then click on any field that needs to change and put in the correct information without having to enter everything else that did not change.
    However don't use a macro. In the On Click property call for an event procedure. Then simply enter the lines
    HomeAddressName = ShipAddressName
    HomeAddressStreet = ShipAddressStreet
    HomeAddressCity = ShipAddressCity
    etc. (assuming those are the names of the fields) between the Private Sub and End Sub lines.
    PGT

  6. #6
    Join Date
    Sep 2013
    Posts
    4
    Agree on principle with healdem and under other circumstances I'd opt for another approach but as Pete Townsend pointed out the differences are minor and I think that these circumstances call for duplication. Thanks for all the input

  7. #7
    Join Date
    Sep 2013
    Posts
    4
    I've been testing this and am getting a runtime error '-2147352567 (80020009)
    Private Sub SameAddress_Click()
    Address = S_Address
    City = S_City
    State = S_State
    Postcode = S_Postcode
    End Sub

    For something so simple this is doing my head in.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •