Results 1 to 3 of 3
  1. #1
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71

    Question recordset update is creating new records instead of updating them.

    hi all

    im trying to do a simple update of all the records in continuous subform.

    i have the following code set to the submit button on the main form

    Code:
     
    
    Dim rsw As New RecordSetWrapper
    
     With rsw.GetRecordsetClone(Me.frmbill_worksubform.Form.Recordset)                While Not .EOF
            If IsNull(![outdate]) Then
                         
                   rsw.Edit
                   ![outdate] = Now()
                   rsw.Update
                            
                        End If
                        rsw.MoveNext
                    Wend
                End With
    what this is doing is creating a new entry in my workcard table which i definitely don't want.

    relevant tables
    bill | bill_work | workcard

    relevant forms
    frmbill | frmbill_worksubform


    the bill table is the main table that lists all the bills with billid | customerid | bdate | total amount
    the bill_work table lists the details of the bill based on the detailid | billid | work_id | unit_amount
    the workcard table lists all the details of each item with workid | indate | all sorts of different fields pertaining to that item | outdate



    basically the workcard is the work order of the item. when an item is ready to sell it will be selected in the frmbill_worksubform. when i hit the submit button the outdate should populate for each item in the subform hence showing that it is sold. those items that don't have an outdate will be available to select in the subform but those that have an outdate will not be shown for selection as naturally they are not available anymore.

    can someone point to how i can do this. i am using northwind traders 2007 as my base template.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    why are you using code?
    use an update query to ENSURE an update query.

  3. #3
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71

    how to do update query

    Quote Originally Posted by ranman256 View Post
    why are you using code?
    use an update query to ENSURE an update query.
    i am thinking the code is easier to manage then update query. how would i go about doing the update query. meaning how to let it know that i only want the records that meet the criteria based on the frmbill/frmbill_worksubform billid

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-14-2016, 02:18 PM
  2. Replies: 5
    Last Post: 07-09-2015, 11:39 AM
  3. Update Query returning more records than table it is updating
    By frustratedwithaccess in forum Queries
    Replies: 4
    Last Post: 02-07-2015, 04:20 PM
  4. Replies: 4
    Last Post: 01-22-2015, 09:57 AM
  5. Update query not updating records
    By toer121 in forum Queries
    Replies: 1
    Last Post: 08-25-2011, 07:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums