Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Dec 2001
    Location
    Franklin, North Carolina, USA
    Posts
    124
    Thanks
    0
    Thanked 2 Times in 1 Post

    Duplicating a field into another field (2000 (9.0.3821 SR-1))

    I've been agonizing over this for a week now with help from you guys and wanted to share the answer I came up with.

    My problem was to add a new field which copies the contents of an existing field while prefixing a "2". Existing field says 1234, new field must say 21234. Here's how I solved it.

    In the ControlSource Property of the new field, enter ="2" & [name of field to be copied]

    I found enough information in Help under "examples of expressions" to dope it out. When it worked, I sucked in air and said "Oh, my, <img src=/w3timages/censored.gif alt=censored border=0> " right out loud. Every record in the database has it's little 2 field populated with no extra entry. I'm looking good!

    Hope it might help anyone else with a similar problem.
    Kris

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Duplicating a field into another field (2000 (9.0.3821 SR-1))

    You could also achieve this in the AfterUpdate of the textbox in which you enter your data.

    Private Sub txtEntryTextBox_AfterUpdate()
    Me.txtResultTextBox = "2" & Me.txtEntryTextBox.Value
    End Sub

    If you are using control source property, it will always have the prefix of 2, but what if [name of field to be copied] contains no data.
    You will have to test and see if you come up with any problems.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2001
    Location
    Franklin, North Carolina, USA
    Posts
    124
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Duplicating a field into another field (2000 (9.0.3821 SR-1))

    In this instance, [name of field to be copied] is the primary key, Required Yes, Allow Zero Length No, Indexed Yes (No Duplicates). But I see your point. I'm saving your instructions in case I ever have to do this again. Thanks!
    Kris

Posting Permissions

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