Results 1 to 14 of 14
  1. #1
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7

    Populating a text box using a form button

    Hi,
    So I have a form with a Number of Text box's,


    Text box 1 is where a user can type a location "We will call this TEXT-BOX A"
    At the bottom of my form I have another text box with some buttons next to it "I will call this TEXT BOX B", if the user clicks the buttons a paragraph of text is placed in Text Box B.
    All working with this code,
    Code:
    Private Sub direct_Click()funeralnotes.SetFocus
    funeralnotes.Text = "The hearse will proceed from our Chapel of Rest direct to,"
    End Sub
    What I want to do is add the location to the end of that paragraph, ie "the hearse will proceed from our Chapel of Rest direct to,[WHAT EVER IS IN TEXT BOX A]"
    Can this be done?
    Screenshot of my form,
    Click image for larger version. 

Name:	Screenshot_1.jpg 
Views:	12 
Size:	98.9 KB 
ID:	41833
    Any help would be great,
    Cheers
    Mark

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Sure:

    Me.funeralnotes= "The hearse will proceed from our Chapel of Rest direct to," & Me.TextboxName

    By the way, you only need the SetFocus line because you used the .Text property of the textbox. The line above will work without it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    Spot on, Many thanks Works a treat

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    Is there a way to add more to this, ie,
    Code:
     Me.funeralnotes= "The hearse and [CARS] will proceed from our Chapel of Rest direct to," & Me.TextboxName
    I have tried
    Code:
    Me.funeralnotes= "The hearse and & Me.Cars will proceed from our Chapel of Rest direct to," & Me.location
    but this does not work, I have also tried
    Code:
    Me.funeralnotes= "The hearse and" & Me.Cars "will proceed from our Chapel of Rest direct to," & Me.location
    again no luck

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Try:
    Code:
    Me.funeralnotes= "The hearse and " & Me.Cars & " will proceed from our Chapel of Rest direct to," & Me.location
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    Hi Many thanks, Nope that came up with a error.

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    What is "Me.Cars" that you said you had tried
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    ME.Cars is a List box so you can select 1 Car or 2 Cars ect,
    Click image for larger version. 

Name:	cars.jpg 
Views:	7 
Size:	46.4 KB 
ID:	41839

  10. #10
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    What do you have as the Row Source property and the Row Source Type property of the combo box
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #11
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    Click image for larger version. 

Name:	cars2.jpg 
Views:	7 
Size:	46.7 KB 
ID:	41840
    I hope this helps

  12. #12
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by robsonma View Post
    Hi Many thanks, Nope that came up with a error.
    What was the error
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  13. #13
    robsonma is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2020
    Posts
    7
    My Mistake, Just checked the code and I had a mistake It does work, thank you so Much you have been very helpfull.

  14. #14
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by robsonma View Post
    My Mistake, Just checked the code and I had a mistake It does work, thank you so Much you have been very helpfull.
    Glad you got it working.
    Thank you for your kind words
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 5
    Last Post: 12-07-2019, 01:32 AM
  2. Replies: 1
    Last Post: 08-04-2014, 07:37 AM
  3. Replies: 9
    Last Post: 06-02-2014, 08:10 AM
  4. Replies: 1
    Last Post: 10-28-2011, 01:57 PM
  5. Replies: 15
    Last Post: 09-18-2010, 01:19 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