Jump to content
Fórum Script Brasil
  • 0

Ajuda neste codigo


jntrindade

Question

boa note, sou novato no forum gostaria que me ajudassem no codigo abaixo, o que ta faltando e tranferir os dados do subformulario orcamento para o subformulario pedido. Desde já agradeço pela atençaõ. fico no aguardo.

Dim db1 As Database, db2 As Database, rs1 As Recordset, rs2 As Recordset, i As Long

If MsgBox("Confirma a venda?", vbYesNo + vbQuestion, "CONFIRMAR") = vbYes Then

Set db1 = CurrentDb

Set db2 = CurrentDb

Set rs1 = db1.OpenRecordset("tblvenda", dbOpenTable)

Set rs2 = db2.OpenRecordset("tblpedido", dbOpenTable)

rs1.AddNew

rs1("Datavenda") = Me.Datavenda

rs1("hora") = Me.hora

rs1("cod_vendedor") = Me.cod_vendedor

rs1("vendedor") = Me.vendedor

rs1("valor") = Me.valor

rs1.Update

rs1.Close

Set rs1 = Nothing

Set db1 = Nothing

For i = 0 To Me.codvenda

rs2.AddNew

rs2("codvenda") = DMax("codvenda", "tblvenda")

rs2("cod_produto") = Forms!frmorcamento!frmsuborcamento![cod_produto]

rs2("produto") = Forms!frmorcamento!frmsuborcamento![produto]

rs2("precounit") = Forms!frmorcamento!frmsuborcamento![precounit]

rs2("quant") = Forms!frmorcamento!frmsuborcamento![quant]

rs2("desc") = Forms!frmorcamento!frmsuborcamento![desc]

rs2("total") = Forms!frmorcamento!frmsuborcamento![total]

rs2("Iditem") = Forms!frmorcamento!frmsuborcamento![codpedido]

rs2.Update

Next i

rs2.Close

Set rs2 = Nothing

Set db2 = Nothing

MsgBox "Venda confirmada.", vbOKOnly + vbInformation, "Concluído"

DoCmd.OpenForm "frmindica", acNormal

Exit Sub

End If

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...