I have a large text box, and an "add comment" button, that will insert two carraige returns, the name of the person logged in, and the date. (I know I could have designed it differently, but I thought this would make it more user friendly).
What I want it to do, is not insert the returns if there is nothing in the box. I attempted to do this by telling it, if the contents of the box <>"" put in the returns, which works, but if the contents do = "", do not put in the returns. At first I thought that maybe the contents were null, so as a test, I tried changing it to not put returns in if the value = "X"(and remming out the first if then set). But after putting an x in there, it doesn't work. So basically, I can't get an = comparison to return true.
If I have nothing in the box, it won't insert anything when I press the add comments button. So I can assume that Access is detecting the contents of the empty text box as being equal to =. So how can a condition register as a false, but the opposite not be registered as true?
Dim user As String
Dim curdate As String
user = CurrentUser
curdate = Now()
Dim Notes_text As String
If Me.Notes_txt.Value <> "" Then
Notes_text = Me.Notes_txt.Value & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "-" & user & " " & curdate & " writes:"
End If
If Me.Notes_txt.Value = "" Then
Notes_txt = "-" & user & " " & curdate & " writes:"
End If
Me.Notes_txt.Value = Notes_text
What I want it to do, is not insert the returns if there is nothing in the box. I attempted to do this by telling it, if the contents of the box <>"" put in the returns, which works, but if the contents do = "", do not put in the returns. At first I thought that maybe the contents were null, so as a test, I tried changing it to not put returns in if the value = "X"(and remming out the first if then set). But after putting an x in there, it doesn't work. So basically, I can't get an = comparison to return true.
If I have nothing in the box, it won't insert anything when I press the add comments button. So I can assume that Access is detecting the contents of the empty text box as being equal to =. So how can a condition register as a false, but the opposite not be registered as true?
Dim user As String
Dim curdate As String
user = CurrentUser
curdate = Now()
Dim Notes_text As String
If Me.Notes_txt.Value <> "" Then
Notes_text = Me.Notes_txt.Value & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "-" & user & " " & curdate & " writes:"
End If
If Me.Notes_txt.Value = "" Then
Notes_txt = "-" & user & " " & curdate & " writes:"
End If
Me.Notes_txt.Value = Notes_text