Results 1 to 4 of 4
  1. #1
    jtuomi
    Guest

    Default values when creating a new record

    I used to have a large database that was made with Lotus Approach 97. It (Approach) was very easy to use but as the database grew larger I realised I needed more muscle and decided to start using Approach 2000 instead.

    I have had truckloads of problems. There are lots of instances where in Approach I could just add a check in a box and get something done, whereas in Approach 2000 I'd have to write a little program to do the same thing.

    For instance, something very basic, example: I have a customer database where each customer has a street address and a mailing address. For most customers these two fields are equal. So to avoid unnecessary typing, when I create a new customer, as soon as I have added the street address, it should be copied to the mailing address field. After this customer record has been saved I should be able to modify the street address or the mailing address, without the other field being effected.

    I have asked this question in many places before. The answer I mainly get is: "write some code to do this..." But I can't write any code to do this. Can please somebody write a small sample database (with just a few fields like: name, street address, mailing address). I could then look at it and edit it to suit my purposes.

    But beware, I have a lot of similar questions waiting. If you can answer this, you will be floode with new ones...

    Jari Tuomi

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default values when creating a new record

    Hi Jari,

    I honestly don't know the first thing about Approach. But since this is an Access forum, I'll include the code I
    would use in Access to accomplish the same thing.
    By the way, you could also assign a macro to do the same thing this code will - using the SetValue macro.

    This assumes that you've used certain field names. You'll have to modify your field names or the code for this to work for you. Create an unbound checkbox field ("chkAddress") and have the fields for Stree address and Mailing Address...<pre>Private Sub chkAddress_Click()
    If chkAddress = True Then
    Mailing_Fname.Value = Street_Fname.Value
    Mailing_Lname.Value = Street_Fname.Value
    Mailing_Address1.Value = Street_Address1.Value
    Mailing_Address2.Value = Street_Address2.Value
    Mailing_City.Value = Street_City.Value
    Mailing_State.Value = Street_State.Value
    Mailing_ZIP.Value = Street_Zip.Value
    Else
    Mailing_Fname.Value = ""
    Mailing_Lname.Value = ""
    Mailing_Address1.Value = ""
    Mailing_Address2.Value = ""
    Mailing_City.Value = ""
    Mailing_State.Value = ""
    Mailing_ZIP.Value = ""
    End If
    End Sub</pre>

    The first part of the If...Then statement sets the mailing address field values to match the street address field values. The second part of the statement (Else...) will set the values of the mailing address to nothing if you un-check the box.
    I realize this may have nothing to do with Approach, but if you use Access this should do the trick.
    Hope this helps <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  3. #3
    jtuomi
    Guest

    Re: Default values when creating a new record

    Sorry!

    I, of course, meant Access 2000 (not Approach 2000); I wrote my question in a hurry. I was using Lotus Approach 97, now I am "trying to use" MS Access 2000.

    Regards, Jari Tuomi

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Default values when creating a new record

    Actually, it's poor database design to do this at all. Approach is a very simple database that isn't all that far removed from spreadsheets, so it doesn't force you to really design anything. You need to get some training on relational design or you'll keep struggling to do things the way you did them in Approach when that isn't the way you should do them if you want to clean relational database.
    Charlotte

Posting Permissions

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