Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    3

    Exclamation Unanswered: DAO MoveNext in Continuous Form

    I have a form (frm_approval) which is based on a query (qry_unapproved). The query queries a table (tbl_total) for records that are unapproved and shows these records in (frm_approval) so the approver can use the form to approve them via checking a check box.
    The form is set to Continuous View and I get many rows of textboxes (RecordName & RecordQty), each row for 1 record to be approved. For every record, I have a checkbox field (chkbox) which will be uncheck when the form opens up.
    My idea is for the approver to check the records he approves and clicks on an command button that requery the form. (tbl_total) will be updated and everyone is happy.
    Now there is a qty for each record. When the record is approved, the approved qty should be deducted from an inventory table (tbl_inventory)

    Now, I coded into the command button the following VBA code:
    ================================================== ==
    Private Sub Commandbutton_ApproveRequests_Click()

    Dim db As DAO.Database
    Dim recset As DAO.Recordset

    If chkbox = True Then
    Set db = CurrentDb()
    Set recset = db.OpenRecordset("tbl_inventory", dbOpenDynaset)

    recset.FindFirst "RecordName = '" & Me.RecordName & "'"
    recset.Edit
    recset!RecordQty = recset!RecordQty - Me.RecordQty
    recset.Update
    End If

    Me.Requery
    'Me refers to frm_approval

    End Sub
    ==================================================

    The problem here is that when I check more than 1 record, only the qty of 1 record (the most bottom checked record) gets updated in (tbl_inventory). How do I make it such that any checked record qty gets updated in (tbl_inventory)?


  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    You need to write a query querying for those rows checked as approved and run thru that recordset updating your inventory ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Scratch that ... This looks like not a BE issue ... You can perform your inventory update on the AfterUpdate event of the checkbox ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •