danielrcom
31-05-2012 11:21:46
Pessoal,
Estou com uma dificuldade enorme em depurar o erro:

O erro está acontecendo por causa de uma variável denominada "cartinha_cn" (declarada como String), que recebe os textos "SIM" ou "NÃO" dependendo do OptionButton selecionado:
Meu INSERT INTO está da seguinte forma:
E o erro acontece na linha:
Qualquer ajuda será bem-vinda. Grato.
Estou com uma dificuldade enorme em depurar o erro:

O erro está acontecendo por causa de uma variável denominada "cartinha_cn" (declarada como String), que recebe os textos "SIM" ou "NÃO" dependendo do OptionButton selecionado:
Código: Selecionar todos
'obrigatório: Cartinha CN
Dim cartinha_cn As String
If Me.op_cartinha_sim = False And _
Me.op_cartinha_nao = False Then
MsgBox "Por favor, selecione [Cartinha CN: Sim] ou [Cartinha CN: Não]"
Exit Sub
End If
If op_cartinha_sim = True Then cartinha_cn = "SIM"
If op_cartinha_nao = True Then cartinha_cn = "NAO"
Código: Selecionar todos
strSQL = "INSERT INTO T_Dados([Registro], [Data], [Hora], [Turno], [Conferente], [Quantidade Itens], [Tipo Divergência], [Tipo Conferência], [Produto], [Estação], [Quantidade Itens Erro], [Rota], [Remessa], [Pedido], [Palete], [Dupla Conferente], [Observação], [Cartinha CN])"
strSQL = strSQL & " VALUES ("
strSQL = strSQL & " '" & Me.cx_registro.Value & "'"
strSQL = strSQL & ", '" & Me.cx_data.Value & "'"
strSQL = strSQL & ", '" & Format(Time, "hh:mm") & "'"
strSQL = strSQL & ", '" & Me.cx_turno.Value & "'"
strSQL = strSQL & ", '" & Me.cx_nome.Value & "'"
strSQL = strSQL & ", '" & Me.cx_qtd_itens.Value & "'"
strSQL = strSQL & ", '" & tipo_divergencia & "'"
strSQL = strSQL & ", '" & tipo_conferencia & "'"
strSQL = strSQL & ", '" & Me.cx_produto.Value & "'"
strSQL = strSQL & ", '" & Me.cx_estacao.Value & "'"
strSQL = strSQL & ", '" & Me.cx_qtd_erro.Value & "'"
strSQL = strSQL & ", '" & Me.cx_rota.Value & "'"
strSQL = strSQL & ", '" & Me.cx_remessa.Value & "'"
strSQL = strSQL & ", '" & Me.cx_pedido.Value & "'"
strSQL = strSQL & ", '" & Me.cx_palete.Value & "'"
strSQL = strSQL & ", '" & Me.combo_duplaconf.Value & "'"
strSQL = strSQL & ", '" & Me.combo_observacao.Value & "'"
strSQL = strSQL & ", '" & cartinha_cn & "'"
strSQL = strSQL & " )"
Código: Selecionar todos
' Executa comando SQL
rs.Open strSQL, cn