locked
Make TextBox invisible if text within the field is a certain value RRS feed

  • Question

  • My team has created a form in Access which shows me two data sets - I compare these data sets and make various actions based on their content.

    To speed up the process what I would like to do, is that if, in the field preview (which I am able to edit), the text is a set value e.g. "#matching#" then I would like that to become invisible (for that record).

    I've had a look online and this is what I have come up with (which isn't working):

    Option Explicit

    If Me.cmdNewForename = "#matching#" Then

    Me.cmdNewForename.Visible = False

    Else

    Me.cmdNewForname.Visible = True

    End If

    I'm also not sure if the variable is correct/what to use.

    Any help/ideas?

    Thanks!

    Wednesday, August 31, 2016 3:54 PM

Answers

  • Hi Beginner909,

    Here I assume that "cmdNewForname" is a textbox.

    you had mentioned the code and its not working.

    see the code below how to use it correctly.

    Private Sub Command6_Click()
    If Me.Text4.Value = Me.Text2.Value Then
    Me.Text2.Visible = False
    Else
    Me.Text2.Visible = True
    End If
    End Sub
    

    When you run the code first you will see a blank form in field preview textbox you have to manually enter the data. and in other textbox data will come from the dataset.

    click on check button. if both the value match then it will hidden the dataset textbox.

    but here I don't understand one thing. you had mentioned that , "To speed up the process what I would like to do, is that if, in the field preview (which I am able to edit), the text is a set value e.g. "#matching#" then I would like that to become invisible (for that record)."

    How it will speed up your process?

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 1, 2016 2:18 AM