MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração


Participe do fórum, é rápido e fácil

MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração

MaximoAccess

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Dicas Ms Access, Exemplos Ms Access, Codigos VBA Ms Access, SQL Ms Access


2 participantes

    erro de compilação

    avatar
    RodrigoMoura
    Novato
    Novato


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 1
    Registrado : 05/05/2016

    erro de compilação Empty erro de compilação

    Mensagem  RodrigoMoura 5/5/2016, 20:56

    estou fazendo um cadastro de cliente
    baseado em macros

    encontrei esse problema como With

    podem me ajudar

    Function lfValidarDados() As Boolean

       lfValidarDados = False
       
       With Worksheets("Validacao")
       
            If cadastro_de_clientes.caixa_f_nome.Text = "" And .Cells(3, 2).Value = "Sim" Then
               MsgBox "O campo Nome é obrigatório!"
               cadastro_de_clientes.caixa_f_nome.SetFocus
               GoTo Sair
           End If
           
                   If cadastro_de_clientes.caixa_f_cnpj.Text = "" And .Cells(4, 2).Value = "Sim" Then
               MsgBox "O campo Cnpj é obrigatório!"
               cadastro_de_clientes.caixa_f_cnpj.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_F_endereço.Text = "" And .Cells(5, 2).Value = "Sim" Then
               MsgBox "O campo endereço é obrigatório!"
               cadastro_de_clientes.caixa_F_endereço.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_numero.Text = "" And .Cells(6, 2).Value = "Sim" Then
               MsgBox "O campo Número é obrigatório!"
               cadastro_de_clientes.caixa_f_numero.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_bairro.Text = "" And .Cells(7, 2).Value = "Sim" Then
               MsgBox "O campo Bairro é obrigatório!"
               cadastro_de_clientes.caixa_f_bairro.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_cidade.Text = "" And .Cells(8, 2).Value = "Sim" Then
               MsgBox "O campo Cidade é obrigatório!"
               cadastro_de_clientes.caixa_f_cidade.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_uf.Text = "" And .Cells(9, 2).Value = "Sim" Then
               MsgBox "O campo UF é obrigatório!"
               cadastro_de_clientes.caixa_f_uf.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_cep.Text = "" And .Cells(10, 2).Value = "Sim" Then
               MsgBox "O campo cep é obrigatório!"
               cadastro_de_clientes.caixa_f_cep.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_complemento.Text = "" And .Cells(11, 2).Value = "Sim" Then
               MsgBox "O campo complemento é obrigatório!"
              cadastro_de_clientes.caixa_f_complemento.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_fone.Text = "" And .Cells(12, 2).Value = "Sim" Then
               MsgBox "O campo Fone é obrigatório!"
               cadastro_de_clientes.caixa_f_fone.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_celular1.Text = "" And .Cells(13, 2).Value = "Sim" Then
               MsgBox "O campo e-mail Celular1 é obrigatório!"
               cadastro_de_clientes.caixa_f_celular1.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_celular2.Text = "" And .Cells(14, 2).Value = "Sim" Then
               MsgBox "O campo e-mail Celular2 é obrigatório!"
               cadastro_de_clientes.caixa_f_celular2.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_celular3.Text = "" And .Cells(15, 2).Value = "Sim" Then
               MsgBox "O campo e-mail Celular3 é obrigatório!"
               cadastro_de_clientes.caixa_f_celular3.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_email1.Text = "" And .Cells(16, 2).Value = "Sim" Then
               MsgBox "O campo e-mail email1 é obrigatório!"
               cadastro_de_clientes.caixa_f_email1.SetFocus
               GoTo Sair
           End If
               If cadastro_de_clientes.caixa_f_email2.Text = "" And .Cells(17, 2).Value = "Sim" Then
               MsgBox "O campo  email2 é obrigatório!"
               cadastro_de_clientes.caixa_f_email2.SetFocus
               GoTo Sair
           End If
           If cadastro_de_clientes.caixa_f_site.Text = "" And .Cells(18, 2).Value = "Sim" Then
               MsgBox "O campo  site é obrigatório!"
               cadastro_de_clientes.caixa_f_site.SetFocus
               GoTo Sair
           If cadastro_de_clientes.caixa_f_observação.Text = "" And .Cells(19, 2).Value = "Sim" Then
               MsgBox "O campo Observação é obrigatório!"
               cadastro_de_clientes.caixa_f_observação.SetFocus
               GoTo Sair
           End If
           
           End With
           
                       
       
       lfValidarDados = True
           
    Sair:
       Exit Function
    End Function



    quando rodo o programa o depurador me apresenta um erro de compilação referente ao with

    a mensagem é: end with sem o with
    Silvio
    Silvio
    Developer
    Developer


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 5074
    Registrado : 20/04/2011

    erro de compilação Empty Re: erro de compilação

    Mensagem  Silvio 6/5/2016, 01:02

    Olá....

    O maximoaccess, é destinado ao aplicativo Ms Access.

    Sugiro que procure algum fórum de Ms Excel no Google, vai encontrar uns 2 que são muito bons, www.gurudoexcel.com é um deles.

    Até mais.

      Data/hora atual: 19/4/2024, 04:10