N
NJ
Hi,
I have a form which the combo box control that has (0 & 1) and text box
assocaited for the combo box; my question is that; if users select 0 value
from the combo box; then they should be forced to enter some value in the
Text box; currently I have the code at two places as below: but for some
reason; I am not able to force the cursor not to go to the next
control....and should pop-up with the message until some value is entered in
the Text box ....
Private Sub cboTD_AfterUpdate()
If cboTD = "0" And (txtTS_Note = "" Or IsNull(txtTS_Note)) Then
txtTS_Note.SetFocus
txtTS_Note.BackColor = vbRed
Else
If (cboTD = "1" Or cboTD = "N/A") And (txtTS_Note = "" Or
IsNull(txtTS_Note)) Then
txtTS_Note.BackColor = vbWhite
End If
End If
End Sub
Private Sub txtTS_Note_LostFocus()
If cboTD = "0" And (txtTS_Note = "" Or IsNull(txtTS_Note)) Then
txtTS_Note.BackColor = vbRed
MsgBox ("Please enter a value for the TS Notes field")
Me.txtTS_Note.SetFocus
Exit Sub
End If
End Sub
I have a form which the combo box control that has (0 & 1) and text box
assocaited for the combo box; my question is that; if users select 0 value
from the combo box; then they should be forced to enter some value in the
Text box; currently I have the code at two places as below: but for some
reason; I am not able to force the cursor not to go to the next
control....and should pop-up with the message until some value is entered in
the Text box ....
Private Sub cboTD_AfterUpdate()
If cboTD = "0" And (txtTS_Note = "" Or IsNull(txtTS_Note)) Then
txtTS_Note.SetFocus
txtTS_Note.BackColor = vbRed
Else
If (cboTD = "1" Or cboTD = "N/A") And (txtTS_Note = "" Or
IsNull(txtTS_Note)) Then
txtTS_Note.BackColor = vbWhite
End If
End If
End Sub
Private Sub txtTS_Note_LostFocus()
If cboTD = "0" And (txtTS_Note = "" Or IsNull(txtTS_Note)) Then
txtTS_Note.BackColor = vbRed
MsgBox ("Please enter a value for the TS Notes field")
Me.txtTS_Note.SetFocus
Exit Sub
End If
End Sub