Usuário com melhor resposta
Como faço para apagar a foto do cadastro anterior?

Pergunta
-
Estou desenvolvendo um formulário para cadastro de colaboradores. Contudo, estou com uma dificuldade: quando consulto um cadastro e esse cadastro está completo, ou seja: todos os campos preenchidos e inclusive com foto, na nova consulta, só que esse novo cadastro agora incompleto, por exemplo: sem foto, a imagem da consulta anterior permanece. Como faço para a imagem da consulta anterior desaparecer, apesar do novo cadastro consultado não tem uma foto no banco de dados?
Respostas
-
APAGUE A IMAGEM ANTES DE FAZER UMA PESQUISA.
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 sábado, 18 de novembro de 2017 22:31
- Editado AndersonFDiniz2 sábado, 18 de novembro de 2017 22:39
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
-
Private Sub CommandButton1_Click() 'APAGA A IMAGEM Image1.Picture = Nothing 'FAZ A PESQUISA 'COLOQUE O CÓDIGO DA PESQUISA AQUI
'CARREGUE A IMAGEM REFERENTE A ESTA PESQUISA End Sub
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 sábado, 18 de novembro de 2017 22:31
- Editado AndersonFDiniz2 sábado, 18 de novembro de 2017 22:42
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
-
Private Sub cmdPesquisar_Click() imfoto.picture = nothing On Error Resume Next Dim imagem Dim endereco As String endereco = "C:\PRODUTOS\" If txtCodigo.Text = "" Then MsgBox "Digite o Código do colaborador" txtCodigo.SetFocus Exit Sub End If With Worksheets("Dados Clientes").Range("A:A") Set c = .Find(txtCodigo.Value, LookIn:=xlValues, LookAt:=xlPart) If Not c Is Nothing Then c.Activate txtCodigo.Value = Format(c.Value, "000"".""000") txtNome.Value = c.Offset(0, 1).Value txtCPF.Value = c.Offset(0, 2).Value txtRG.Value = c.Offset(0, 3).Value txtDatadenascimento.Value = c.Offset(0, 4).Value txtDatadeadmissao.Value = c.Offset(0, 5).Value txtEndereco.Value = c.Offset(0, 6).Value txtBairro.Value = c.Offset(0, 7).Value txtNumero.Value = c.Offset(0, 8).Value txtComplemento.Value = c.Offset(0, 9).Value txtCEP.Value = c.Offset(0, 10).Value txtCidade.Value = c.Offset(0, 11).Value txtEstado.Value = c.Offset(0, 12).Value txtTelefonefixo.Value = c.Offset(0, 13).Value txtTelefonecelular.Value = c.Offset(0, 14).Value txtTelefonepararecado.Value = c.Offset(0, 15).Value txtEmail.Value = c.Offset(0, 16).Value txtObservacoes1.Value = c.Offset(0, 17).Value txtNomeconjuge.Value = c.Offset(0, 18).Value txtDatadenascimentoconjuge.Value = c.Offset(0, 19).Value txtIdadeconjuge.Value = c.Offset(0, 20).Value txtDependente1.Value = c.Offset(0, 21).Value txtDatadenascimentoDP1.Value = c.Offset(0, 22).Value txtIdadeDP1.Value = c.Offset(0, 23).Value txtDependente2.Value = c.Offset(0, 24).Value txtDatadenascimentoDP2.Value = c.Offset(0, 25).Value txtIdadeDP2.Value = c.Offset(0, 26).Value txtDependente3.Value = c.Offset(0, 27).Value txtDatadenascimentoDP3.Value = c.Offset(0, 28).Value txtIdadeDP3.Value = c.Offset(0, 29).Value txtDependente4.Value = c.Offset(0, 30).Value txtDatadenascimentoDP4.Value = c.Offset(0, 31).Value txtIdadeDP4.Value = c.Offset(0, 32).Value txtObservacoes2.Value = c.Offset(0, 33).Value txtSetor.Value = c.Offset(0, 34).Value txtCargo.Value = c.Offset(0, 35).Value txtAtivo.Value = c.Offset(0, 36).Value txtHorario1.Value = Format(c.Offset(0, 37).Value, "hh:mm") txtHorario2.Value = Format(c.Offset(0, 38).Value, "hh:mm") txtHorario3.Value = Format(c.Offset(0, 39).Value, "hh:mm") txtHorario4.Value = Format(c.Offset(0, 40).Value, "hh:mm") txtVencimentodeexame.Value = c.Offset(0, 41).Value txtSalariobase.Value = Format(c.Offset(0, 42).Value, "currency") txtInsalubridade.Value = Format(c.Offset(0, 43).Value, "00") & "%" txtGratificacao.Value = Format(c.Offset(0, 44).Value, "00") & "%" txtAssiduidade.Value = Format(c.Offset(0, 45).Value, "00") & "%" txtReducaodeperdas.Value = Format(c.Offset(0, 46).Value, "00") & "%" txtOutros1.Value = Format(c.Offset(0, 47).Value, "00") & "%" txtOutros2.Value = Format(c.Offset(0, 48).Value, "00") & "%" txtOutros3.Value = Format(c.Offset(0, 49).Value, "00") & "%" txtOutros4.Value = Format(c.Offset(0, 50).Value, "00") & "%" txtObservacoes3.Value = c.Offset(0, 51).Value txtSubtotal = Format(c.Offset(0, 58).Value, "currency") txtPercentualtotal = Format(c.Offset(0, 59).Value, "00") & "%" txtValortotal = Format(c.Offset(0, 60).Value, "currency") txtTotalgeral = Format(c.Offset(0, 63).Value, "currency") imagem = endereco & c.Offset(0, 61).Value imFoto.Picture = LoadPicture(imagem) imFoto.PictureSizeMode = fmPictureSizeModeZoom Else MsgBox "Colaborador não localizado!" End If End With End Sub
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 domingo, 19 de novembro de 2017 13:59
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
Todas as Respostas
-
APAGUE A IMAGEM ANTES DE FAZER UMA PESQUISA.
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 sábado, 18 de novembro de 2017 22:31
- Editado AndersonFDiniz2 sábado, 18 de novembro de 2017 22:39
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
-
Private Sub CommandButton1_Click() 'APAGA A IMAGEM Image1.Picture = Nothing 'FAZ A PESQUISA 'COLOQUE O CÓDIGO DA PESQUISA AQUI
'CARREGUE A IMAGEM REFERENTE A ESTA PESQUISA End Sub
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 sábado, 18 de novembro de 2017 22:31
- Editado AndersonFDiniz2 sábado, 18 de novembro de 2017 22:42
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
-
Anderson, não possível automatizar isso? Quem vai utilizar o formulário é o pessoal do RH.
---------------------------------
Private Sub cmdPesquisar_Click()
On Error Resume Next
Dim imagem
Dim endereco As String
endereco = "C:\PRODUTOS\"
If txtCodigo.Text = "" Then
MsgBox "Digite o Código do colaborador"
txtCodigo.SetFocus
Exit Sub
End If
With Worksheets("Dados Clientes").Range("A:A")
Set c = .Find(txtCodigo.Value, LookIn:=xlValues, LookAt:=xlPart)
If Not c Is Nothing Then
c.Activate
txtCodigo.Value = Format(c.Value, "000"".""000")
txtNome.Value = c.Offset(0, 1).Value
txtCPF.Value = c.Offset(0, 2).Value
txtRG.Value = c.Offset(0, 3).Value
txtDatadenascimento.Value = c.Offset(0, 4).Value
txtDatadeadmissao.Value = c.Offset(0, 5).Value
txtEndereco.Value = c.Offset(0, 6).Value
txtBairro.Value = c.Offset(0, 7).Value
txtNumero.Value = c.Offset(0, 8).Value
txtComplemento.Value = c.Offset(0, 9).Value
txtCEP.Value = c.Offset(0, 10).Value
txtCidade.Value = c.Offset(0, 11).Value
txtEstado.Value = c.Offset(0, 12).Value
txtTelefonefixo.Value = c.Offset(0, 13).Value
txtTelefonecelular.Value = c.Offset(0, 14).Value
txtTelefonepararecado.Value = c.Offset(0, 15).Value
txtEmail.Value = c.Offset(0, 16).Value
txtObservacoes1.Value = c.Offset(0, 17).Value
txtNomeconjuge.Value = c.Offset(0, 18).Value
txtDatadenascimentoconjuge.Value = c.Offset(0, 19).Value
txtIdadeconjuge.Value = c.Offset(0, 20).Value
txtDependente1.Value = c.Offset(0, 21).Value
txtDatadenascimentoDP1.Value = c.Offset(0, 22).Value
txtIdadeDP1.Value = c.Offset(0, 23).Value
txtDependente2.Value = c.Offset(0, 24).Value
txtDatadenascimentoDP2.Value = c.Offset(0, 25).Value
txtIdadeDP2.Value = c.Offset(0, 26).Value
txtDependente3.Value = c.Offset(0, 27).Value
txtDatadenascimentoDP3.Value = c.Offset(0, 28).Value
txtIdadeDP3.Value = c.Offset(0, 29).Value
txtDependente4.Value = c.Offset(0, 30).Value
txtDatadenascimentoDP4.Value = c.Offset(0, 31).Value
txtIdadeDP4.Value = c.Offset(0, 32).Value
txtObservacoes2.Value = c.Offset(0, 33).Value
txtSetor.Value = c.Offset(0, 34).Value
txtCargo.Value = c.Offset(0, 35).Value
txtAtivo.Value = c.Offset(0, 36).Value
txtHorario1.Value = Format(c.Offset(0, 37).Value, "hh:mm")
txtHorario2.Value = Format(c.Offset(0, 38).Value, "hh:mm")
txtHorario3.Value = Format(c.Offset(0, 39).Value, "hh:mm")
txtHorario4.Value = Format(c.Offset(0, 40).Value, "hh:mm")
txtVencimentodeexame.Value = c.Offset(0, 41).Value
txtSalariobase.Value = Format(c.Offset(0, 42).Value, "currency")
txtInsalubridade.Value = Format(c.Offset(0, 43).Value, "00") & "%"
txtGratificacao.Value = Format(c.Offset(0, 44).Value, "00") & "%"
txtAssiduidade.Value = Format(c.Offset(0, 45).Value, "00") & "%"
txtReducaodeperdas.Value = Format(c.Offset(0, 46).Value, "00") & "%"
txtOutros1.Value = Format(c.Offset(0, 47).Value, "00") & "%"
txtOutros2.Value = Format(c.Offset(0, 48).Value, "00") & "%"
txtOutros3.Value = Format(c.Offset(0, 49).Value, "00") & "%"
txtOutros4.Value = Format(c.Offset(0, 50).Value, "00") & "%"
txtObservacoes3.Value = c.Offset(0, 51).Value
txtSubtotal = Format(c.Offset(0, 58).Value, "currency")
txtPercentualtotal = Format(c.Offset(0, 59).Value, "00") & "%"
txtValortotal = Format(c.Offset(0, 60).Value, "currency")
txtTotalgeral = Format(c.Offset(0, 63).Value, "currency")
imagem = endereco & c.Offset(0, 61).Value
imFoto.Picture = LoadPicture(imagem)
imFoto.PictureSizeMode = fmPictureSizeModeZoom
Else
MsgBox "Colaborador não localizado!"
End If
End With
End Sub -
Private Sub cmdPesquisar_Click() imfoto.picture = nothing On Error Resume Next Dim imagem Dim endereco As String endereco = "C:\PRODUTOS\" If txtCodigo.Text = "" Then MsgBox "Digite o Código do colaborador" txtCodigo.SetFocus Exit Sub End If With Worksheets("Dados Clientes").Range("A:A") Set c = .Find(txtCodigo.Value, LookIn:=xlValues, LookAt:=xlPart) If Not c Is Nothing Then c.Activate txtCodigo.Value = Format(c.Value, "000"".""000") txtNome.Value = c.Offset(0, 1).Value txtCPF.Value = c.Offset(0, 2).Value txtRG.Value = c.Offset(0, 3).Value txtDatadenascimento.Value = c.Offset(0, 4).Value txtDatadeadmissao.Value = c.Offset(0, 5).Value txtEndereco.Value = c.Offset(0, 6).Value txtBairro.Value = c.Offset(0, 7).Value txtNumero.Value = c.Offset(0, 8).Value txtComplemento.Value = c.Offset(0, 9).Value txtCEP.Value = c.Offset(0, 10).Value txtCidade.Value = c.Offset(0, 11).Value txtEstado.Value = c.Offset(0, 12).Value txtTelefonefixo.Value = c.Offset(0, 13).Value txtTelefonecelular.Value = c.Offset(0, 14).Value txtTelefonepararecado.Value = c.Offset(0, 15).Value txtEmail.Value = c.Offset(0, 16).Value txtObservacoes1.Value = c.Offset(0, 17).Value txtNomeconjuge.Value = c.Offset(0, 18).Value txtDatadenascimentoconjuge.Value = c.Offset(0, 19).Value txtIdadeconjuge.Value = c.Offset(0, 20).Value txtDependente1.Value = c.Offset(0, 21).Value txtDatadenascimentoDP1.Value = c.Offset(0, 22).Value txtIdadeDP1.Value = c.Offset(0, 23).Value txtDependente2.Value = c.Offset(0, 24).Value txtDatadenascimentoDP2.Value = c.Offset(0, 25).Value txtIdadeDP2.Value = c.Offset(0, 26).Value txtDependente3.Value = c.Offset(0, 27).Value txtDatadenascimentoDP3.Value = c.Offset(0, 28).Value txtIdadeDP3.Value = c.Offset(0, 29).Value txtDependente4.Value = c.Offset(0, 30).Value txtDatadenascimentoDP4.Value = c.Offset(0, 31).Value txtIdadeDP4.Value = c.Offset(0, 32).Value txtObservacoes2.Value = c.Offset(0, 33).Value txtSetor.Value = c.Offset(0, 34).Value txtCargo.Value = c.Offset(0, 35).Value txtAtivo.Value = c.Offset(0, 36).Value txtHorario1.Value = Format(c.Offset(0, 37).Value, "hh:mm") txtHorario2.Value = Format(c.Offset(0, 38).Value, "hh:mm") txtHorario3.Value = Format(c.Offset(0, 39).Value, "hh:mm") txtHorario4.Value = Format(c.Offset(0, 40).Value, "hh:mm") txtVencimentodeexame.Value = c.Offset(0, 41).Value txtSalariobase.Value = Format(c.Offset(0, 42).Value, "currency") txtInsalubridade.Value = Format(c.Offset(0, 43).Value, "00") & "%" txtGratificacao.Value = Format(c.Offset(0, 44).Value, "00") & "%" txtAssiduidade.Value = Format(c.Offset(0, 45).Value, "00") & "%" txtReducaodeperdas.Value = Format(c.Offset(0, 46).Value, "00") & "%" txtOutros1.Value = Format(c.Offset(0, 47).Value, "00") & "%" txtOutros2.Value = Format(c.Offset(0, 48).Value, "00") & "%" txtOutros3.Value = Format(c.Offset(0, 49).Value, "00") & "%" txtOutros4.Value = Format(c.Offset(0, 50).Value, "00") & "%" txtObservacoes3.Value = c.Offset(0, 51).Value txtSubtotal = Format(c.Offset(0, 58).Value, "currency") txtPercentualtotal = Format(c.Offset(0, 59).Value, "00") & "%" txtValortotal = Format(c.Offset(0, 60).Value, "currency") txtTotalgeral = Format(c.Offset(0, 63).Value, "currency") imagem = endereco & c.Offset(0, 61).Value imFoto.Picture = LoadPicture(imagem) imFoto.PictureSizeMode = fmPictureSizeModeZoom Else MsgBox "Colaborador não localizado!" End If End With End Sub
A MELHOR FORMA DE AGRADECER E VOTAR COMO UTIL OU MARCAR COMO RESPOSTA Anderson Diniz diniabr2011@gmail.com
- Sugerido como Resposta AndersonFDiniz2 domingo, 19 de novembro de 2017 13:59
- Marcado como Resposta Vejabem domingo, 19 de novembro de 2017 21:10
-