Gimpster
Jan 14th, 2000, 02:04 AM
I have an If/Then statement that I'm having trouble with, I don't think I have it set up right. Here's what I'm trying to do, the statement updates a database, but that's not the problem, the problem is that I have three text boxes that could be empty and I need to keep the update statement from executing when the program comes across those text boxes, but only if the text box is empty. This is what I tried already and it didn't keep the program from executing the update statement from executing on the empty text boxes. Tell me what I need to change.
Public Function UpdateFields()
Dim x As Object
For Each x In Me.Controls()
If Left(x.Name, 3) = "txt" Then
If x.Name <> "txtdate_hired" Or x.Name <> "txtdate_terminated" Or x.Name <> "txtbirth_date" And x.Text = "" Then
Connection.Execute ("UPDATE Employees SET " & Mid(x.Name, 4) & "= '" & x.Text & "' WHERE ss_number = " & txtss_number.Text)
End If
End If
Next x
RecordChanged = False
End Function
------------------
Ryan
[This message has been edited by Gimpster (edited 01-14-2000).]
Public Function UpdateFields()
Dim x As Object
For Each x In Me.Controls()
If Left(x.Name, 3) = "txt" Then
If x.Name <> "txtdate_hired" Or x.Name <> "txtdate_terminated" Or x.Name <> "txtbirth_date" And x.Text = "" Then
Connection.Execute ("UPDATE Employees SET " & Mid(x.Name, 4) & "= '" & x.Text & "' WHERE ss_number = " & txtss_number.Text)
End If
End If
Next x
RecordChanged = False
End Function
------------------
Ryan
[This message has been edited by Gimpster (edited 01-14-2000).]