PERDENDO O FOCO - PORQUE
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
Use o evento _VALIDATE em vez de LOSTFOCUS.
Vai ser mais feliz...
At,
Vai ser mais feliz...
At,
Visite...
http://www.vbmania.com.br/vbmania/vbmforum.php?varMethod=Abrir&varID=217459&varPagina=1
At,
http://www.vbmania.com.br/vbmania/vbmforum.php?varMethod=Abrir&varID=217459&varPagina=1
At,
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
Hugo
Vc está certo.
Grato
Vc está certo.
Grato
se funcionou não esqueça de encerrar i tópico. ;)
Ok desculpa rsrsrsr
Tópico encerrado , respostas não são mais permitidas