ola galera eu sou iniciante em vb6 e tou resolvendo um exercicio duma apostila tirada na net.......que contem mts erros..........o codigo é este: erro em limpar tela Private Sub LimparDados() 'Apaga o conteúdo dos campos do formulário: txtNomeUsuario.Text = Empty txtEndereco.Text = Empty txtCidade.Text = Empty txtEstado.Text = Empty txtCEP.Text = Empty txtTelefone.Text = Empty End Sub Private Sub LimparTela() 'Chama a sub LimparDados para limpar os campos do formulário: LimparDados 'Desabilita o botão Excluir: Toolbar1.Buttons(3).Enabled = False 'Apaga o conteúdo do campo CodUsuario e lhe passa o foco: txtCodUsuario.Text = Empty txtCodUsuario.SetFocus End SUB O ERRO ENCONTRA-SE ILUSTRADO PELA COR VERMELHA erro gravar dados Private Sub GravarDados() Dim cnnComando As New ADODB.Command Dim vConfMsg As Integer Dim vErro As Boolean On Error GoTo errGravacao 'Inicializa as variáveis auxiliares: vConfMsg = vbExclamation + vbOKOnly + vbSystemModal vErro = False 'Verifica os dados digitados: If txtNomeUsuario.Text = Empty Then MsgBox "O campo Nome não foi preenchido.", vConfMsg, "Erro" vErro = True End If If txtEndereco.Text = Empty Then MsgBox "O campo Endereço não foi preenchido.", vConfMsg, "Erro" vErro = True End If If txtCidade.Text = Empty Then MsgBox "O campo Cidade não foi preenchido.", vConfMsg, "Erro" vErro = True End If If txtEstado.Text = Empty Then MsgBox "O campo Estado não foi preenchido.", vConfMsg, "Erro" vErro = True End If If txtCEP.Text = Empty Then MsgBox "O campo CEP não foi preenchido.", vConfMsg, "Erro" vErro = True End If 'Se aconteceu um erro de digitação, sai da sub sem gravar: If vErro Then Exit Sub Screen.MousePointer = vbHourglass With cnnComando .ActiveConnection = cnnBiblio .CommandType = adCmdText 'Verifica a operação e cria o comando SQL correspondente: If vInclusao Then 'Inclusão: .CommandText = "INSERT INTO Usuarios(CodUsuario, NomeUsuario, Endereco, Cidade, Estado, CEP, Telefone) VALUES ('" & txtCodUsuario.Text & "', '" & txtNomeUsuario.Text & "', '" & txtEndereco.Text & "', '" & txtCidade.Text & "', '" & txtEstado.Text & "', '" & txtCEP.Text & "', '" & txtTelefone.Text & "');" Else 'Alteração: .CommandText = "UPDATE Usuarios SET NomeUsuario = '" & txtNomeUsuario.Text & "', Endereco = '" & txtEndereco.Text & "', Cidade = '" & txtCidade.Text & "', Estado = '" & txtEstado.Text & "', CEP = '" & txtCEP.Text & "', Telefone = '" & txtTelefone.Text & "' WHERE CodUsuario = " & txtCodUsuario.Text & ";" End If .Execute End With MsgBox "Gravação concluída com sucesso.", _ vbApplicationModal + vbInformation + vbOKOnly, _ "Gravação OK" 'Chama a sub que limpa os dados do formulário: LimparTela Saida: Screen.MousePointer = vbDefault Set cnnComando = Nothing Exit Sub errGravacao: With Err If .Number <> 0 Then MsgBox "Houve um erro durante a gravação dos dados na tabela.", _ vbExclamation + vbOKOnly + vbApplicationModal, "Erro" .Number = 0 GoTo Saida End If End With End Sub APOS GRAVAÇÃO CONCLUIDA COM SUCESSO SURGE LOGO EM SEGUIDA UMA OUTRA MENSAGEM DE ERRO erro durante a exclusão Private Sub ExcluirRegistro() Dim cnnComando As New ADODB.Command Dim vOk As Integer On Error GoTo errExclusao 'Solicita confirmação da exclusão do registro: vOk = MsgBox("Confirma a exclusão desse registro?", _ vbApplicationModal + vbDefaultButton2 + vbQuestion + vbYesNo, _ "Exclusão") If vOk = vbYes Then Screen.MousePointer = vbHourglass With cnnComando .ActiveConnection = cnnBiblio .CommandType = adCmdText 'Cria o comando SQL: .CommandText = "DELETE FROM Usuarios WHERE CodUsuario = " & txtCodUsuario.Text & ";" .Execute End With MsgBox "Registro excluído com sucesso.", _ vbApplicationModal + vbInformation + vbOKOnly, _ "Exclusão OK" 'Chama a sub que apaga todos os campos do formulário: LimparTela End If Saida: Screen.MousePointer = vbDefault Set cnnComando = Nothing Exit Sub errExclusao: With Err If .Number <> 0 Then MsgBox "Houve um erro durante a exclusão do registro.", _ vbExclamation + vbOKOnly + vbApplicationModal, "Erro" .Number = 0 GoTo Saida End If End With End Sub APOS EXCLUSÃO CONCLUIDA COM SUCESSO SURGE LOGO EM SEGUIDA UMA OUTRA MENSAGEM DE ERRO PRECISO DA VOSSA AJUDA