Neste bd a mais informações no formulário1
http://speedy.sh/cZYzJ/Agravina.zip
Option Compare Database
Option Explicit 'Variavel que receberá a forma de pagamento
Dim VarPgto As String
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'F1 - Sem Uso
'If KeyCode = 112 Then
'xxxxxxxxxxxxx
' KeyCode = 0
'End If
'F2 - Sem Uso
'If KeyCode = 113 Then
'kxxxxxxxxxx
' KeyCode = 0
'End If
'F3 - Venda a Prazo
If KeyCode = 114 Then
VarPgto = "Venda a Prazo"
MsgBox VarPgto
KeyCode = 0
End If
'F4 - Venda a vista
If KeyCode = 115 Then
VarPgto = "Venda a Vista"
MsgBox VarPgto
KeyCode = 0
End If
'F5 - Venda a Cartão
If KeyCode = 116 Then
VarPgto = "Venda a Cartão"
MsgBox VarPgto
KeyCode = 0
End If
'F6 - Sem uso
'If KeyCode = 117 Then
'xxxxxxxxxx
'KeyCode = 0
'End If
'F7 - Sem Uso
'If KeyCode = 118 Then
'xxxxxxxxxxx
'KeyCode = 0
'End If
'F8 - Sem Uso
'If KeyCode = 119 Then
'xxxxxxxxxxx
'KeyCode = 0
'End If
'F9 - Sem Uso
'If KeyCode = 120 Then
'xxxxxxxxxxx
'KeyCode = 0
'End If
'F11 - Sem Uso
'If KeyCode = 122 Then
'xxxxxxxxxxxx
'KeyCode = 0
'End If
'F12 - Sem Uso
'If KeyCode = 123 Then
'xxxxxxxxxxxx
KeyCode = 0
'End If
End Sub
Private Sub txtcod_AfterUpdate()
If DCount("[Código]", "tblProdutos", "[CodBarras]= '" & Me.txtcod & "'") = 0 Then
MsgBox "Produto não Cadatrado", vbCritical, "Atenção"
Exit Sub
End If
If IsNull(VarPgto) = True Or VarPgto = "" Then
MsgBox "Você necessita escolher a forma de pagamento," & vbCrLf & _
"Escolha a forma de pagamento de acordo com as opções:" & vbCrLf & _
" F-3 para venda a prazo" & vbCrLf & _
" F-4 para venda a vista" & vbCrLf & _
" F-5 para venda a cartão", vbCritical, "Atenção"
Else
Me.txtproduto.Value = DLookup("[produto]", "tblprodutos", "[codbarras]= '" & Me.txtcod.Value & "'")
Me.txtPreco.Value = DLookup("[preçovenda]", "tblprodutos", "[codbarras]= '" & Me.txtcod.Value & "'")
Me.txtBarra.Value = DLookup("[codbarras]", "tblprodutos", "[codbarras]= '" & Me.txtcod.Value & "'")
Me.txtproduto.Requery
DoCmd.SetWarnings False
DoCmd.RunSQL ("INSERT INTO tblProdutos_1 (CodBarras, Produto,PreçoVenda,FormaPagto ) Values(""" & Me.txtBarra & """,'" & Me.txtproduto & "',""" & Me.txtPreco & """,""" & VarPgto & """)")
DoCmd.RunSQL ("INSERT INTO tblItensVenda (CodBarras, Produto,PreçoVenda,FormaPgto ) Values(""" & Me.txtBarra & """,'" & Me.txtproduto & "',""" & Me.txtPreco & """,""" & VarPgto & """)")
End If
DoCmd.SetWarnings True
Me.Lista2.Requery
End Sub