PC Review


Reply
Thread Tools Rate Thread

looping through a continuous form recordset

 
 
New Member
Join Date: Feb 2012
Posts: 2
 
      14th Feb 2012
Hi there,
For some time now I'm having the following problem.
I have a main form with contionuous subform (pic1.png). What i want to do is when I change the value of a combobox in the main for to be able to change one of subforms's textboxes. My problem is that I only get the first row to change. I get the folowing error --> shown on err.png
So is there a way to change them all?

Here's my code. I call the function in the combobox's AfterUpdate event:

Code:
Private Sub calculateWeight()
    Me!frmCalculatorDetails.Form!art_id.SetFocus
    Me!frmCalculatorDetails.Form!art_qty_scrap.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value * Me.calc_scrap_nonscrap.Value
    Me!frmCalculatorDetails.Form!art_weight_gross.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value + Me!frmCalculatorDetails.Form!art_qty_scrap.Value

    With Me!frmCalculatorDetails.Form!RecordsetClone
        While Not .EOF
            Me!frmCalculatorDetails.Form!art_qty_scrap.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value * Me.calc_scrap_nonscrap.Value
            Me!frmCalculatorDetails.Form!art_weight_gross.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value + Me!frmCalculatorDetails.Form!art_qty_scrap.Value
            If Not .EOF Then .MoveNext
        Wend
    End With
    
End Sub
Attached Thumbnails
looping through a continuous form recordset-pic1.gif   looping through a continuous form recordset-err.gif  

Last edited by antoniadim; 14th Feb 2012 at 04:25 PM..
 
Reply With Quote
 
 
 
 
New Member
Join Date: Feb 2012
Posts: 2
 
      14th Feb 2012
I made the following changes to the code, but now it only updates the selected record:

Code:
Private Sub calculateWeight()
    Me!frmCalculatorDetails.Form!art_id.SetFocus
    Me!frmCalculatorDetails.Form!art_qty_scrap.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value * Me.calc_scrap_nonscrap.Value
    Me!frmCalculatorDetails.Form!art_weight_gross.Value = Me!frmCalculatorDetails.Form!art_weight_net.Value + Me!frmCalculatorDetails.Form!art_qty_scrap.Value

    With Me.frmCalculatorDetails.Form.RecordsetClone
        While Not .EOF
            Me.frmCalculatorDetails.Form.art_qty_scrap.Value = Me.frmCalculatorDetails.Form.art_weight_net.Value * Me.calc_scrap_nonscrap.Value
            Me.frmCalculatorDetails.Form.art_weight_gross.Value = Me.frmCalculatorDetails.Form.art_weight_net.Value + Me.frmCalculatorDetails.Form.art_qty_scrap.Value
            If Not .EOF Then .MoveNext
        Wend
    End With
    
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recordset looping (and debug looping!) =?Utf-8?B?U3RlcGhhbmll?= Microsoft Access Form Coding 16 7th May 2007 08:17 PM
Re: Looping through a continuous subform John Vinson Microsoft Access 0 28th Jan 2007 03:23 AM
Re: Looping through a continuous subform Richard Microsoft Access 0 28th Jan 2007 02:41 AM
Moving through a Continuous Form's Recordset Frank Reichenbacher Microsoft Access Form Coding 4 12th Feb 2004 05:44 PM
Re: Looping Through A Recordset Bob Phillips Microsoft Excel Programming 0 19th Aug 2003 03:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:52 AM.