Results 1 to 4 of 4
  1. #1
    zdjbel is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    25

    Show text box in a form based on a character within a string in another text box


    Hi,

    I have a form where I want a textbox [txtMaxOrdLimit] to be visible only if another text box on the same form [PaNumber] contains the letter D in the string. This is the code I have on the forms On Current property but I'm missing something because textbox [txtMaxOrdLimit] doesn't show on the form at all.

    If Me.PaNumber = "*D" Then
    Me.txtMaxOrdLimit.Visible = True
    Else
    Me.txtMaxOrdLimit.Visible = False
    End If


    Thanks very much.

  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,521
    To use a wildcard you need to use Like instead of =. Also, that would only work if D was the last letter. If you want it anywhere in the string: "*D*".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    zdjbel is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    25
    Quote Originally Posted by pbaldy View Post
    To use a wildcard you need to use Like instead of =. Also, that would only work if D was the last letter. If you want it anywhere in the string: "*D*".

    Thanks very much, I thought that "Like" could only be used in queries.

  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,521
    No problem.
    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. Text String from Form Query - Multiple Choices
    By wrandyrice in forum Access
    Replies: 1
    Last Post: 08-12-2012, 10:58 AM
  2. Automated Character Count for Text Box
    By gopherking in forum Forms
    Replies: 3
    Last Post: 09-23-2011, 12:21 PM
  3. Replies: 15
    Last Post: 04-01-2011, 11:41 AM
  4. Text Box control and character limit?
    By Bigdoggit in forum Forms
    Replies: 2
    Last Post: 03-29-2011, 10:05 AM
  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