Notifications
Clear all

CheckBox em formulário

11 Posts
2 Usuários
0 Reactions
1,822 Visualizações
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Pessoal,

Bom dia.

Tenho uma estrutura em um formulário com 5 Checkbox e ao clicar em um deles habilita 3 textbox ao lado.

Ou seja:

Checkbox1 = True Habilita textbox1 / textbox2 / textbox3

Mas depois ao clicar no botão de ADICIONAR, que vai adicionar os dados imputados nas textbox, ao final do código eu quero que limpe as 3 textbox, que fique com o backstyle transparente e desabilite (enable=false). Porém não está dando certo.

Estou utilizando o código abaixo:

Me.txtLote1 = Empty
Me.txtFardos1 = Empty
Me.txtInstrucao1 = Empty
txtLote1.BackStyle = fmBackStyleTransparent
txtFardos1.BackStyle = fmBackStyleTransparent
txtInstrucao1.BackStyle = fmBackStyleTransparent
Me.txtLote1.Enabled = False
Me.txtFardos1.Enabled = False
Me.txtInstrucao1.Enabled = False
Me.CheckBoxLote1 = False

Me.txtLote2 = Empty
Me.txtFardos2 = Empty
Me.txtInstrucao2 = Empty
txtLote2.BackStyle = fmBackStyleTransparent
txtFardos2.BackStyle = fmBackStyleTransparent
txtInstrucao2.BackStyle = fmBackStyleTransparent
Me.txtLote2.Enabled = False
Me.txtFardos2.Enabled = False
Me.txtInstrucao2.Enabled = False
Me.CheckBoxLote2 = False

... conjunto 3... conjunto 4... conjunto 5

Se eu utilizar apenas o primeiro conjunto (1) o código funciona mas caso tenha o checkbox 2 habilitado, e os demais, aí o código somente coloca os checkbox como False.

Alguém pode me ajudar com isso por favor?

 
Postado : 12/12/2016 7:16 am
(@mprudencio)
Posts: 0
New Member
 

Se disponibilizar o arquivo fica mais facil

 
Postado : 12/12/2016 7:19 am
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Marcelo,

Bom dia.

Não estou conseguindo anexar o arquivo pois o tamanho máximo é de 2MB. Já coloquei em RAR e não vai ... Tamanho é de 5.616 KB ... E não vai ...

Obrigado pelo retorno.

 
Postado : 12/12/2016 8:14 am
(@mprudencio)
Posts: 0
New Member
 

Coloca em um servidor qualquer e poe o link aqui

 
Postado : 12/12/2016 10:16 am
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Marcelo,

Segue o link: https://drive.google.com/file/d/0B25Dj- ... Jjdzg/view

 
Postado : 12/12/2016 10:57 am
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Marcelo,

Com o código abaixo ele funciona até a última linha sem comentário. Se eu deixar executar os 4 últimos comandos não funciona.

Me.txtLote1 = Empty
Me.txtLote2 = Empty
Me.txtLote3 = Empty
Me.txtLote4 = Empty
Me.txtLote5 = Empty

Me.txtFardos1 = Empty
Me.txtFardos2 = Empty
Me.txtFardos3 = Empty
Me.txtFardos4 = Empty
Me.txtFardos5 = Empty

Me.txtInstrucao1 = Empty
Me.txtInstrucao2 = Empty
Me.txtInstrucao3 = Empty
Me.txtInstrucao4 = Empty
Me.txtInstrucao5 = Empty

txtLote5.BackStyle = fmBackStyleTransparent
txtLote4.BackStyle = fmBackStyleTransparent
txtLote3.BackStyle = fmBackStyleTransparent
txtLote2.BackStyle = fmBackStyleTransparent
txtLote1.BackStyle = fmBackStyleTransparent

txtFardos5.BackStyle = fmBackStyleTransparent
txtFardos4.BackStyle = fmBackStyleTransparent
txtFardos3.BackStyle = fmBackStyleTransparent
txtFardos2.BackStyle = fmBackStyleTransparent
txtFardos1.BackStyle = fmBackStyleTransparent

txtInstrucao1.BackStyle = fmBackStyleTransparent
txtInstrucao2.BackStyle = fmBackStyleTransparent
txtInstrucao3.BackStyle = fmBackStyleTransparent
txtInstrucao4.BackStyle = fmBackStyleTransparent
txtInstrucao5.BackStyle = fmBackStyleTransparent

Me.txtLote5.Enabled = False
Me.txtLote4.Enabled = False
Me.txtLote3.Enabled = False
Me.txtLote2.Enabled = False
Me.txtLote1.Enabled = False

Me.txtFardos5.Enabled = False
Me.txtFardos4.Enabled = False
Me.txtFardos3.Enabled = False
Me.txtFardos2.Enabled = False
Me.txtFardos1.Enabled = False

Me.txtInstrucao1.Enabled = False
Me.txtInstrucao2.Enabled = False
Me.txtInstrucao3.Enabled = False
Me.txtInstrucao4.Enabled = False
Me.txtInstrucao5.Enabled = False

Me.CheckBoxLote1 = False
'Me.CheckBoxLote2 = False <- A PARTIR DAQUI NÃO FUNCIONA
'Me.CheckBoxLote3 = False
'Me.CheckBoxLote4 = False
'Me.CheckBoxLote5 = False
 
Postado : 12/12/2016 11:05 am
(@mprudencio)
Posts: 0
New Member
 

O codigo teoricamente deveria funcionar no botao cadastrar mas nao tem codigo nenhum la.

Ele é executado em que momento?

 
Postado : 12/12/2016 12:33 pm
(@tiagogn)
Posts: 0
New Member
Topic starter
 

O código está no botão adicionar.

-> Private Sub btnAdicionarNF_Click()

O botão cadastrar é só para finalizar porque pode adicionar outras NFs e aí aproveita as informações da esquerda.

 
Postado : 12/12/2016 12:43 pm
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Marcelo,

Boa tarde.

Conseguiu se achar no código que eu coloquei. Como eu disse está um pouco confuso pois estou tentando de todas as formas e até o momento não obtive êxito.

Obrigado.

Abraços.

 
Postado : 13/12/2016 2:51 pm
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Pessoal,

Boa tarde.

Alguém tem uma luz no "fim do túnel" ? rs

Já fiz "N" tentativas mas até o momento não consegui arranjar uma solução.

Agradeço desde já.

Abraços.

 
Postado : 16/12/2016 9:54 am
(@tiagogn)
Posts: 0
New Member
Topic starter
 

Pessoal,

Coloquei o código em um "Private sub teste"... E coloquei um botão de teste no formulário chamando apenas esse sub teste... Funcionou ...

Mas colocando no botão correto que chama outros 2 subs antes ... Ele não funciona... Desmarca o checkbox mas não limpa... inativa... etc os textbox...

Código no botão correto:

Private Sub btnAdicionarNF_Click()

CadastrarRecebimento

Procura_Chegada

teste

End Sub

Código no botão de teste:

Private Sub teste()

FrmRecebimento.CheckBoxLote1.Value = False
FrmRecebimento.CheckBoxLote2.Value = False
FrmRecebimento.CheckBoxLote3.Value = False
FrmRecebimento.CheckBoxLote4.Value = False
FrmRecebimento.CheckBoxLote5.Value = False

Me.txtLote1 = Empty
Me.txtFardos1 = Empty
Me.txtInstrucao1 = Empty
Me.txtLote1.BackStyle = fmBackStyleTransparent
Me.txtFardos1.BackStyle = fmBackStyleTransparent
Me.txtInstrucao1.BackStyle = fmBackStyleTransparent
Me.txtLote1.Enabled = False
Me.txtFardos1.Enabled = False
Me.txtInstrucao1.Enabled = False

Me.txtLote2 = Empty
Me.txtFardos2 = Empty
Me.txtInstrucao2 = Empty
Me.txtLote2.BackStyle = fmBackStyleTransparent
Me.txtFardos2.BackStyle = fmBackStyleTransparent
Me.txtInstrucao2.BackStyle = fmBackStyleTransparent
Me.txtLote2.Enabled = False
Me.txtFardos2.Enabled = False
Me.txtInstrucao2.Enabled = False

Me.txtLote3 = Empty
Me.txtFardos3 = Empty
Me.txtInstrucao3 = Empty
Me.txtLote3.BackStyle = fmBackStyleTransparent
Me.txtFardos3.BackStyle = fmBackStyleTransparent
Me.txtInstrucao3.BackStyle = fmBackStyleTransparent
Me.txtLote3.Enabled = False
Me.txtFardos3.Enabled = False
Me.txtInstrucao3.Enabled = False

Me.txtLote4 = Empty
Me.txtFardos4 = Empty
Me.txtInstrucao4 = Empty
Me.txtLote4.BackStyle = fmBackStyleTransparent
Me.txtFardos4.BackStyle = fmBackStyleTransparent
Me.txtInstrucao4.BackStyle = fmBackStyleTransparent
Me.txtLote4.Enabled = False
Me.txtFardos4.Enabled = False
Me.txtInstrucao4.Enabled = False

Me.txtLote5 = Empty
Me.txtFardos5 = Empty
Me.txtInstrucao5 = Empty
Me.txtLote5.BackStyle = fmBackStyleTransparent
Me.txtFardos5.BackStyle = fmBackStyleTransparent
Me.txtInstrucao5.BackStyle = fmBackStyleTransparent
Me.txtLote5.Enabled = False
Me.txtFardos5.Enabled = False
Me.txtInstrucao5.Enabled = False

End Sub

Detalhe: Fiz o código passo a passo e foi funcionando. No momento que eu inseri os "FrmRecebimento.CheckBoxLoteX.Value = False" ele desmarca os checkbox mas não define os outros parâmetros (value=empty, backstyle e enabled).

Por favor... Alguém tem alguma sugestão?

 
Postado : 23/12/2016 9:41 am