PERDENDO O FOCO - PORQUE

USUARIO.EXCLUIDOS 06/06/2007 16:21:18
#220078


NO MESMO FORM.

NO Segundo campo da data o foco volta para o campo anterior e o comando são iguIS.

O que acontece ?


Funciona tb_dt ja o tb_dv volta sempre para o foco tb_dt


Private Sub tb_dt_LostFocus()
' Se o tamanho do campo for igual a 0 ,ele retorna ate o preenchimento correto
If Len(tb_dt.ClipText) < 8 And Len(tb_dt.ClipText) = 0 Then
MsgBox "Informe a data.", vbExclamation, "ATENÇÃO"
tb_dt.SetFocus
Exit Sub
End If
If tb_dt.ClipText <> "" Then
' Se o valor digitado for diferente de branco ele entra na funcao FU_Checa
If Not Fu_Checa_Data(CStr(tb_dt.Text)) Then
MsgBox "DATA INVALIDA", vbExclamation, "ATENÇÃO"
'Limpa campo apos o retorno do foco
tb_dt.Text = "__/__/____"
tb_dt.SetFocus
Exit Sub
End If
End If
End Sub





Private Sub tb_dv_LostFocus()
If Len(tb_dv.ClipText) < 6 And Len(tb_dv.ClipText) = 0 Then
MsgBox "Informe a data.", vbExclamation, "ATENÇÃO"
tb_dt.SetFocus
Exit Sub
End If
If tb_dv.ClipText <> "" Then
If Not Fu_Checa_Data_Documentacao(CStr(tb_dv.Text)) Then
MsgBox "DATA INVALIDA", vbExclamation, "ATENÇÃO"
tb_dv.Text = "__/____"
tb_dv.SetFocus
Exit Sub
End If
End If
End Sub



USUARIO.EXCLUIDOS 06/06/2007 16:38:37
#220085
Use o evento _VALIDATE em vez de LOSTFOCUS.
Vai ser mais feliz...
At,
USUARIO.EXCLUIDOS 06/06/2007 16:43:30
#220087
Visite...

http://www.vbmania.com.br/vbmania/vbmforum.php?varMethod=Abrir&varID=217459&varPagina=1

At,
HUGOSSOUZA 06/06/2007 17:51:59
#220104
Resposta escolhida
não se entendi direito mas no text dois não é pra voltar pro text1?

If Len(tb_dv.ClipText) < 6 And Len(tb_dv.ClipText) = 0 Then
MsgBox "Informe a data.", vbExclamation, "ATENÇÃO"
tb_dt.SetFocus 'aqui ta errado
Exit Sub
End If

If Len(tb_dv.ClipText) < 6 And Len(tb_dv.ClipText) = 0 Then
MsgBox "Informe a data.", vbExclamation, "ATENÇÃO"
tb_dv.SetFocus
Exit Sub
End If

USUARIO.EXCLUIDOS 08/06/2007 13:22:00
#220375
Hugo

Vc está certo.

Grato
HUGOSSOUZA 08/06/2007 13:52:29
#220384
se funcionou não esqueça de encerrar i tópico. ;)
USUARIO.EXCLUIDOS 08/06/2007 13:59:18
#220386
Ok desculpa rsrsrsr
Tópico encerrado , respostas não são mais permitidas