This code seem to have several problems, the most prominate though, is that It only pulls back the frist record and will not continue to loop through the rest of the records pulled from the qurey. What I am trying to do is pull orders that a customer's check should be applied to. I was not able to get a clear answer on how to do this so I took a shot at it myself (6 or 7 times). This actually brought back something other then an error. Although it is only bringing back the first value in [qryorders] and nothing else.
My best shot
'first set of critera'
If (Reports![rptdglrpt].[running sum] < Forms![frmDGLRPT].[check1]) Then
Reports![rptdglrpt].[order_amt]'order_amt is an unbound field on the report'= Reports![rptdglrpt].[qryorders]
'this should pull back a single value according to the above critera text80 control source is an'order $ amount field from the table''
'second set of critera'
ElseIf Reports![rptdglrpt].[running sum] > Forms![frmDGLRPT].[check1] Then
'this should populate order_amt with the remainder of the check'
Reports![rptdglrpt].[order_amt] = Reports![rptdglrpt].[running sum] - Forms![frmDGLRPT].[check1]
End If
My best shot
'first set of critera'
If (Reports![rptdglrpt].[running sum] < Forms![frmDGLRPT].[check1]) Then
Reports![rptdglrpt].[order_amt]'order_amt is an unbound field on the report'= Reports![rptdglrpt].[qryorders]
'this should pull back a single value according to the above critera text80 control source is an'order $ amount field from the table''
'second set of critera'
ElseIf Reports![rptdglrpt].[running sum] > Forms![frmDGLRPT].[check1] Then
'this should populate order_amt with the remainder of the check'
Reports![rptdglrpt].[order_amt] = Reports![rptdglrpt].[running sum] - Forms![frmDGLRPT].[check1]
End If