Results 1 to 5 of 5
  1. #1
    mwolfod is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2010
    Posts
    36

    Setting Text Box Value from Multiple other Text Boxes

    I want to set the value of a text box on a form to equal values assembled from other text boxes on the same form:



    [LastName][FirstName] followed by the current date.

    So I want a string stored in the new text box such as:

    SmithJohn-02-14-2010


    I would then like this string automatically copied to the Windows Clipboard and/or with an adjacent command button that allows the user to do this.


    Thanks for the help!

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    suppose I have 4 text boxes txt1,txt2,txt3,txt4 on the control source put:

    txt1=FirstName
    txt2=LastName
    txt3=Date

    =[txt1]&"" & [txt2] & "-" & [txt3]

  3. #3
    mwolfod is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2010
    Posts
    36
    Beautiful, but how I do insert the current date in mm-dd-yyyy format.

    Also, any idea how this entire text string can then be automatically copied to the Windows Clipboard, and I would also like to set up a Command Button so that the users can do the Copy manually.


    Thanks much!

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I have used three textboxes in this example:
    Text0=FirstName
    Text2=LastName
    Text3=is were the string is assembled

    I will have first assembled my string in the textbox Text3 attaching this expression in its controlsource. this expression will ensure your current date is formatted as u want:

    =[Text0] & [Text2] & "-" & Format(Date(),"mm-dd-yyyy")

    I have attached this code to the onclick event of a Commandbutton this code will copy the string to the windows clipboard.

    Me.Text3.SetFocus
    RunCommand acCmdCopy

    Mark the thread solved if this solves your problem.

  5. #5
    mwolfod is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2010
    Posts
    36
    Yes, thanks.

    I had worked the date problem out myself, but couldn't work the code out for the Copy.

    The Copy to Clipboard code works fine with a command button, but for some reason I cannot get it to work in the AfterUpdate or OnChange fields on various TextBoxes on the form.

    Thanks.

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

Similar Threads

  1. setting up option boxes for text values
    By wlumpkin in forum Access
    Replies: 4
    Last Post: 02-08-2011, 09:33 AM
  2. How to count multiple text boxes
    By Brian62 in forum Reports
    Replies: 6
    Last Post: 11-10-2010, 03:22 PM
  3. Replies: 15
    Last Post: 09-18-2010, 01:19 PM
  4. Setting a field to only accept text characters, not numbers
    By USAFA2012 in forum Database Design
    Replies: 2
    Last Post: 03-09-2010, 12:37 PM
  5. joining text in text boxes
    By jjwilliams73 in forum Forms
    Replies: 1
    Last Post: 08-26-2008, 02:30 PM

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