Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por andre220
#35066
Caros amigos,

Não estou conseguindo impedir que o campo CodProduto aceite cadastro em duplicidade.
Alguém poderia me ajudar? Muito obrigado
Código: Selecionar todos
Private Sub UserForm_Activate()
    cnnBanco.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & ThisWorkbook.Path & "\Banco_SIG.mdb"
    rstBanco.Open "SELECT Id, CodProduto, NomeProduto, Valor FROM TblProduto", cnnBanco, adOpenKeyset, adLockOptimistic, adCmdText
    Indice = rstBanco.AbsolutePosition
    Activar
    
   
End Sub


Sub Incluir_Registro()
    
     If Me.txtCodProduto.Text = "" Or txtNomeProdutoFlora.Text = "" Or Me.txtValor.Text = "" Then
        
       MsgBox "Os campos: Código do Produto, Nome Produto, Valor, não devem ficar em branco, digite!!!", 64, "Aviso"
Else
      
    ''Inserindo os dados na tabela
    With rstBanco
        .AddNew
        .Fields("CodProduto") = Me.txtCodProduto.Text
        .Fields("NomeProduto") = Me.txtNomeProduto.Text
        .Fields("Valor") = Me.txtValor.Text
        rstBanco.Update
        
        lblMensagemSim.Caption = "Registro salvo com sucesso."
        
    End With
    
End If
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord