Results 1 to 7 of 7
  1. #1
    dhicks is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    36

    Talking Dynamic Text Box


    Hello,

    I have a small database that contains a Master Form and a Subform. The Subform holds detailed information about the record being displayed from the Master Form. Currently, I have it set up so that, based on specific criteria in the Subform record, a message box displays with information. The user then clicks on OK and moves on. The problem is that the user generally has to scroll through multiple records when in the form, and it's become annoying to have to click on OK every time a message box appears, which can be frequent. I would like to change the form and add a Text Box that will display the same information as the Message Box, so that the user doesn't have to click on anything to get to the next record. The text box needs to be able to change the message being displayed based on whether certain fields in the subform are populated or not. I'm not sure which Event to use for this. Does anyone have an idea and maybe an example I could follow? Many thanks!!

  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
    The On Current event fires when the form loads and when the user changes records. I'd assume you can use the same code you have but set the value of the textbox instead of showing the message box.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dhicks is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    36
    Quote Originally Posted by pbaldy View Post
    The On Current event fires when the form loads and when the user changes records. I'd assume you can use the same code you have but set the value of the textbox instead of showing the message box.
    Ok, here is the code I am putting in. I'm getting an error message about giving the focus to the text box in order to display the text. This is not working, though. I don't think I am using the Focus property correctly. Can you tell what I am doing wrong here?

    If DCount("*", "qryMsgBoxCriteria", "Item='" & Me!Item & "' And IsNull(Actual_Pickup_Date)") And Checked_Out_YN = True Then
    TxtResInfo.OnGotFocus
    TxtResInfo.Text = "There is an active Reservation on this item, check for potential Date conflicts. This Item is also currently Checked Out."

    ElseIf Checked_Out_YN = True Then
    TxtResInfo.OnGotFocus
    TxtResInfo.Text = "This Item is currently Checked Out"

    ElseIf DCount("*", "qryMsgBoxCriteria", "Item='" & Me!Item & "' And IsNull(Actual_Pickup_Date)") Then
    TxtResInfo.OnGotFocus
    TxtResInfo.Text = "There is an active Reservation on this item, check for potential Date conflicts."
    End If

  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
    Don't use the .Text property, and delete the attempt at setting focus. Try

    Me.TxtResInfo = "This Item is currently Checked Out"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Oh, and more info on the .Text property, which is normally not needed:

    http://www.baldyweb.com/ValueText.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    dhicks is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    36
    That worked!! Thank you very much!!!

  7. #7
    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!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 05-18-2016, 09:46 AM
  2. Replies: 4
    Last Post: 10-17-2015, 09:40 PM
  3. Replies: 3
    Last Post: 02-07-2013, 09:53 PM
  4. Dynamic Text Box ControlSource from multiple tables
    By cjtezak in forum Programming
    Replies: 2
    Last Post: 06-20-2012, 10:07 AM
  5. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 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