I have this code on the after update event of a text box on a data entry form.
Private Sub txtPort_AfterUpdate()
Dim strNumPort As String
Dim strValPort As String
Dim strText As String
strNumPort = Me.txtPort.Value
strValPort = Me.txtValPort.Value
strText = "There are only " & Forms!frmLocation!txtValPort & " ports available for this device"
If strNumPort <= strValPort Then
Else
MsgBox strText
Me.txtPort.Undo
Me.txtPort.SetFocus
End If
End Sub
I know this should be easy and I have been searching archives and help for about 3 hours. But I cannot get the 'me.txtport.undo' and the 'me.txtPort.setfocus' to work. What in the world am I missing?
Thanks for any and all help.
Becki
Private Sub txtPort_AfterUpdate()
Dim strNumPort As String
Dim strValPort As String
Dim strText As String
strNumPort = Me.txtPort.Value
strValPort = Me.txtValPort.Value
strText = "There are only " & Forms!frmLocation!txtValPort & " ports available for this device"
If strNumPort <= strValPort Then
Else
MsgBox strText
Me.txtPort.Undo
Me.txtPort.SetFocus
End If
End Sub
I know this should be easy and I have been searching archives and help for about 3 hours. But I cannot get the 'me.txtport.undo' and the 'me.txtPort.setfocus' to work. What in the world am I missing?
Thanks for any and all help.
Becki