none
Access VBA issue updating Text Boxes in Form RRS feed

  • Question

  • I have an Access form that has several unbound text boxes.  I use the inputs from those text boxes to write to various tables in my database.  When the form loads, all the boxes are blank.  When a user hits a command button, I want to change the value of blank text boxes to "Not Entered" and have "Not Entered" write to my tables. 

    I've been able to find a backwards way to accomplish this by using the following code:

            If "" <> Text6 Then
               Dim y As Integer
            Else
               Text6.Value = "Not Entered"
            End If
            MsgBox Text6.Value

    However, this code does not work:

            If "" = Text6 Then
               Text6.Value = "Not Entered"
            End If
            MsgBox Text6.Value

    Can someone help me write a simple way to see if a Textbox was left blank and if it was, change its value to "Not Entered"?

     

    Thanks!

     

    Thursday, September 29, 2011 8:05 PM

Answers

  • If Text6.Value="" then
        Text6.Value = "Not Entered"
    End If

     


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Friday, September 30, 2011 9:15 AM
  • Or use the IsNull() function to check if Text value is Null or not:

            If IsNull(Text6.Value) Then
               Text6.Value = "Not Entered"
            End If
    
    



    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Monday, November 28, 2011 11:25 PM
    Moderator

All replies

  • If Text6.Value="" then
        Text6.Value = "Not Entered"
    End If

     


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Friday, September 30, 2011 9:15 AM
  • Or use the IsNull() function to check if Text value is Null or not:

            If IsNull(Text6.Value) Then
               Text6.Value = "Not Entered"
            End If
    
    



    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Monday, November 28, 2011 11:25 PM
    Moderator