Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order/Invoicing Question

Status
Not open for further replies.

bigfigkid

Programmer
Feb 18, 2003
26
0
0
CA
I have an order/invoice system which consists of a form with a subform. General information such as client name, date and invoice number are found in the main form, and the subform contains the items ordered along with quantity ordered and quantity shipped.

My question is this.

I would like to create a command button called "orderfilled",located on the parent form, which i want the click event to make the quantity shipped = quantity ordered for every item in the subform. This saves me from typing in quantities shipped since 9/10 times the orders are filled.

Thanks in advance ...
 
You can grab a recordsetclone for the subform and make the updates using DAO:
Code:
Private Sub cmdFillOrders_Click()
On Error GoTo ErrHandler

  Dim rst As Recordset  
  Set rst = Me.CustomerOrdersSubform.Form.RecordsetClone
  
  If rst.RecordCount > 0 Then
    With rst
      .MoveFirst
      While Not .EOF
        .Edit
        .Fields("ShippedQuantity") = .Fields("OrderQuantity")
        .Update
        .MoveNext
      Wend
    End With
  Else
    'no records found
  End If

ExitHere:
  Exit Sub
ErrHandler:
  Debug.Print Err, Err.Description
  Resume ExitHere
End Sub


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
thanks much, worked like a charm.

I have made an update query which worked ok as well, but it was annoying to have to confirm the update when the update query executed.
 
docmd.setwarnings false before your action query then
docmd.setwarnings true after.

That will turn off the confirm popup
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top