Galera, pedi ajuda ontem nesse mesmo projeto mais em outra questão que já foi resolvida.
Agora venho pedir ajuda sobre uma questão que está me deixando encucado. Já olhei, analisei, e pra variar, não consegui enxergar onde está o erro no código.
O erro é que após fazer a pesquisa e clicar no botão Alterar, o mesmo exibe todos os objetos com o  valor "False". E se cancelarmos a alteração ele retorna os valores gravados. Não estou entendendo o porque disso acontecer.
Eu tenho a seguinte rotina no meu botão "Alterar" (no frmPesquisa):
Private Sub btn_Editar_Click()
    'Definir a ação do comando
    sAcaoRequerida = "Editar"
    'Habilitar Botões Salvar/Cancelar
    Call HabilitarControlesParaEdicao(True)
Me.ComboBox_Exercicio1_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio2_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio3_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio4_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio5_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio6_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio7_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio1_A_Gozar.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio2_A_Gozar.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio3_A_Gozar.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio4_A_Gozar.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio5_A_Gozar.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio6_Gozado.RowSource = "parametros!A1:A50"
Me.ComboBox_Exercicio7_A_Gozar.RowSource = "parametros!A1:A50"
End Sub
E essa é a rotina do HabilitarControlesParaEdicao:
Sub HabilitarControlesParaEdicao(ByVal bOpcao As Boolean)
    'Habilitar Botões Salvar/Cancelar
    btn_Salvar.Visible = bOpcao
    btn_Cancelar.Visible = bOpcao
    btn_Editar.Visible = Not (bOpcao)
    btn_Excluir.Visible = Not (bOpcao)
    
    btn_Procurar.Enabled = Not (bOpcao)
    txt_Procurar.Enabled = Not (bOpcao)
    ComboBox1.Enabled = Not (bOpcao)
    txt_Procurar.Value = ""
    Label_Registros_Contador.Caption = ""
    If bOpcao = False And IsArray(MatrizResultadosLinha) Then
        SpinButton1.Enabled = True
    Else
        SpinButton1.Enabled = False
    End If
    'Liberar Campos para Edição.
                'Dados cadastrais
                txt_NomeCompleto.Text = Not (bOpcao)
                txt_IDFuncional.Text = Not (bOpcao)
                txt_Lotacao.Text = Not (bOpcao)
                txt_Cargo.Text = Not (bOpcao)
                'Status do servidor
                OptionButton_Ativo = Not (bOpcao)
                OptionButton_Licenca = Not (bOpcao)
                OptionButton_Aposentado = Not (bOpcao)
                'Data do status do servidor
                txt_Data_Ativo.Text = Not (bOpcao)
                txt_Data_Licenca.Text = Not (bOpcao)
                txt_Data_Aposentado.Text = Not (bOpcao)
                'Período indeferido
                OptionButton_PI_Sim = Not (bOpcao)
                OptionButton_PI_Nao = Not (bOpcao)
                'Pelo processo
                txt_Pelo_Processo.Text = Not (bOpcao)
                'Contado em dobro
                OptionButton_CD_Sim = Not (bOpcao)
                OptionButton_CD_Nao = Not (bOpcao)
                'Exercício 1
                txt_Dias_Gozados_Exercicio1.Text = Not (bOpcao)
                ComboBox_Exercicio1_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio1.Text = Not (bOpcao)
                ComboBox_Exercicio1_A_Gozar = Not (bOpcao)
                'Exercício 2
                txt_Dias_Gozados_Exercicio2.Text = Not (bOpcao)
                ComboBox_Exercicio2_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio2.Text = Not (bOpcao)
                ComboBox_Exercicio2_A_Gozar = Not (bOpcao)
                'Exercício 3
                txt_Dias_Gozados_Exercicio3.Text = Not (bOpcao)
                ComboBox_Exercicio3_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio3.Text = Not (bOpcao)
                ComboBox_Exercicio3_A_Gozar = Not (bOpcao)
                'Exercício 4
                txt_Dias_Gozados_Exercicio4.Text = Not (bOpcao)
                ComboBox_Exercicio4_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio4.Text = Not (bOpcao)
                ComboBox_Exercicio4_A_Gozar = Not (bOpcao)
                'Exercício 5
                txt_Dias_Gozados_Exercicio5.Text = Not (bOpcao)
                ComboBox_Exercicio5_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio5.Text = Not (bOpcao)
                ComboBox_Exercicio5_A_Gozar = Not (bOpcao)
                'Exercício 6
                txt_Dias_Gozados_Exercicio6.Text = Not (bOpcao)
                ComboBox_Exercicio6_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio6.Text = Not (bOpcao)
                ComboBox_Exercicio6_A_Gozar = Not (bOpcao)
                'Exercício 7
                txt_Dias_Gozados_Exercicio7.Text = Not (bOpcao)
                ComboBox_Exercicio7_Gozado = Not (bOpcao)
                txt_Dias_A_Gozar_Exercicio7.Text = Not (bOpcao)
                ComboBox_Exercicio7_A_Gozar = Not (bOpcao)
                'Total de dias gozados e à gozar
                txt_Total_Dias_Gozados.Text = Not (bOpcao)
                txt_Total_Dias_A_Gozar.Text = Not (bOpcao)
    
    'Limpar o conteúdo dos campos
    If sAcaoRequerida <> "Editar" Then
                'Dados cadastrais
                txt_NomeCompleto.Text = Empty
                txt_IDFuncional.Text = Empty
                txt_Lotacao.Text = Empty
                txt_Cargo.Text = Empty
                'Status do servidor
                OptionButton_Ativo.Value = False
                OptionButton_Licenca.Value = False
                OptionButton_Aposentado.Value = False
                'Data do status do servidor
                txt_Data_Ativo.Text = Empty
                txt_Data_Licenca.Text = Empty
                txt_Data_Aposentado.Text = Empty
                'Período indeferido
                OptionButton_PI_Sim.Value = False
                OptionButton_PI_Nao.Value = False
                'Pelo processo
                txt_Pelo_Processo.Text = Empty
                'Contado em dobro
                OptionButton_CD_Sim.Value = False
                OptionButton_CD_Nao.Value = False
                'Exercício 1
                txt_Dias_Gozados_Exercicio1.Text = Empty
                ComboBox_Exercicio1_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio1.Text = Empty
                ComboBox_Exercicio1_A_Gozar.Value = False
                'Exercício 2
                txt_Dias_Gozados_Exercicio2.Text = Empty
                ComboBox_Exercicio2_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio2.Text = Empty
                ComboBox_Exercicio2_A_Gozar.Value = False
                'Exercício 3
                txt_Dias_Gozados_Exercicio3.Text = Empty
                ComboBox_Exercicio3_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio3.Text = Empty
                ComboBox_Exercicio3_A_Gozar.Value = False
                'Exercício 4
                txt_Dias_Gozados_Exercicio4.Text = Empty
                ComboBox_Exercicio4_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio4.Text = Empty
                ComboBox_Exercicio4_A_Gozar.Value = False
                'Exercício 5
                txt_Dias_Gozados_Exercicio5.Text = Empty
                ComboBox_Exercicio5_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio5.Text = Empty
                ComboBox_Exercicio5_A_Gozar.Value = False
                'Exercício 6
                txt_Dias_Gozados_Exercicio6.Text = Empty
                ComboBox_Exercicio6_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio6.Text = Empty
                ComboBox_Exercicio6_A_Gozar.Value = False
                'Exercício 7
                txt_Dias_Gozados_Exercicio7.Text = Empty
                ComboBox_Exercicio7_Gozado.Value = False
                txt_Dias_A_Gozar_Exercicio7.Text = Empty
                ComboBox_Exercicio7_A_Gozar.Value = False
                'Total de dias gozados e à gozar
                txt_Total_Dias_Gozados.Text = Empty
                txt_Total_Dias_A_Gozar.Text = Empty
    End If
    If bOpcao = True Then
        txt_NomeCompleto.SetFocus
    End If
End Sub
                                                                                                	
DGAF / DVGD - Divisão de Gestão de Documentos
Rafael A. Guimarães
[email protected]
                                                 
	                                         
                    
                    	
                            Postado : 14/01/2014 12:29 pm