Página 1 de 1

Problema com textbox

Enviado: 02 Mar 2017 às 11:01
por felmback
Galera bom dia , estou com um problema nas textbox , tenho um bd em Access quando eu preencho as textbox e salvo aparece normal os dados no BD .

Mais ao inves de digitar eu colo os dados ela preenche normal clico para salvar ela executa o código porém quando vou no banco olhar não tem nada gravado , troquei as textbox.text por textbox.value mais não resolveu alguém poderia me apontar a onde estou errando .

ex:


Rs.Fields("Tecnico") = txtTecnico.Value
uso o seguinte código para efetuar a gravação no bd.

Private Sub btnGravar_Click()
On Error Resume Next



If Me.txtPon = "" Or Me.txtTecnico = "" Or Me.txtArd = "" Or Me.txtInstancia = "" Or Me.txtObs = "" Or Me.txtPri = "" Or Me.txtSec = "" Or Me.txtTecnico = "" Or Me.txtCop = "" Or Me.txtArea = "" Or Me.txtSupervisor = "" Then

MsgBox " Preencher todos os campos ", vbCritical, "OSP"


Exit Sub

End If

Rs.AddNew

Rs.Fields("Tecnico") = txtTecnico.Text
Rs.Fields("Instancia") = txtInstancia.Text
Rs.Fields("Supervisor") = txtSupervisor.Text
Rs.Fields("Armario") = txtArd.Text
Rs.Fields("Microarea") = txtArea.Text
Rs.Fields("CopOsp") = txtCop.Value
Rs.Fields("MotivoPendencia") = txtPendencia.Text
Rs.Fields("CodPon") = txtPonII.Text
Rs.Fields("Observacoes") = txtObs.Text
Rs.Fields("Primario") = txtPri.Text
Rs.Fields("Secundario") = txtSec.Text
Rs.Fields("EntradaOsp") = txtEntrada.Text


Rs.Update


MsgBox "Dados Salvos !", vbInformation, "OSP"



Me.txtTecnico.Text = ""
Me.txtInstancia.Text = ""
Me.txtSupervisor.Text = ""
Me.txtArd.Text = ""
Me.txtArea.Text = ""
Me.txtCop.Text = ""
Me.txtPendencia.Text = ""
Me.txtPonII.Text = ""
Me.txtObs.Text = ""
Me.txtPri.Text = ""
Me.txtSec.Text = ""

Me.txtTecnico.SetFocus
End Sub

https://1drv.ms/f/s!AiymJJaGKhi8grwwhCOph4wrFrgDgw

Ajuda com textbox

Enviado: 02 Mar 2017 às 11:24
por Feka
Digitar ou colar os dados na textbox não faz diferença, você está usando o rs.addnew e o rs.update?

Ajuda com textbox

Enviado: 02 Mar 2017 às 11:34
por felmback
Feka obrigado pelo atenção , segue o código de gravação .

Rs.AddNew

Rs.Fields("Tecnico") = txtTecnico.Value
Rs.Fields("Instancia") = txtInstancia.Value
Rs.Fields("Supervisor") = txtsupervisor.Value
Rs.Fields("Armario") = txtArd.Value
Rs.Fields("Microarea") = txtArea.Value
Rs.Fields("CopOsp") = txtCop.Value
Rs.Fields("MotivoPendencia") = txtPendencia.Value
Rs.Fields("CodPon") = txtPonII.Value
Rs.Fields("Observacoes") = txtObs.Value
Rs.Fields("Primario") = txtPri.Value
Rs.Fields("Secundario") = txtSec.Value
Rs.Fields("EntradaOsp") = txtEntrada.Value

Rs.Update

Ajuda com textbox

Enviado: 02 Mar 2017 às 11:44
por felmback
segue o link com a planilha e o bd , não esquecer de editar o caminho ...


https://1drv.ms/f/s!AiymJJaGKhi8grwwhCOph4wrFrgDgw