Loop Question

D

DS

I need to run this procedjure the number of times that TxtDisplay equals.
If TxtDisplay =1 the it runs once
If TxtDisplay =5 then its five

I think the the problrm is with the first line. Any input appreciated.
Thanks
DS

Dim Spliter as Integer

For Spliter = Forms!SplitPad!TxtDisplay
Me.TxtNextLine = DMax("LineID", "SalesDetails", "SalesID =
Forms!MoveItem!TxtLeftID")
Me.TxtNextLine = Me.TxtNextLine + 1

CurrentDb.Execute "INSERT Into
SalesDetails(SalesID,LineID,ItemID,Quantity, " & _
"MenuNum,BasePrice,Taxed,NoTax,Inclusive) " & _
"VALUES(" & Forms!MoveItem!TxtLeftID & "," &
Forms!MoveItem!TxtNextLine & ", " & _
"" & Forms!MoveItem!TxtItemID & ",1," & Forms!MoveItem!TxtMenuID & ",
" & _
"" & Forms!MoveItem!TxtBasePrice & "," & Forms!MoveItem!CheckTax & ",
" & _
"" & Forms!MoveItem!CheckNoTax & "," & Forms!MoveItem!CheckInclusive
& ")"
Next Spliter
 
D

Dirk Goldgar

DS said:
I need to run this procedjure the number of times that TxtDisplay
equals. If TxtDisplay =1 the it runs once
If TxtDisplay =5 then its five

I think the the problrm is with the first line. Any input
appreciated. Thanks
DS

Dim Spliter as Integer

For Spliter = Forms!SplitPad!TxtDisplay
Me.TxtNextLine = DMax("LineID", "SalesDetails", "SalesID =
Forms!MoveItem!TxtLeftID")
Me.TxtNextLine = Me.TxtNextLine + 1

CurrentDb.Execute "INSERT Into
SalesDetails(SalesID,LineID,ItemID,Quantity, " & _
"MenuNum,BasePrice,Taxed,NoTax,Inclusive) " & _
"VALUES(" & Forms!MoveItem!TxtLeftID & "," &
Forms!MoveItem!TxtNextLine & ", " & _
"" & Forms!MoveItem!TxtItemID & ",1," & Forms!MoveItem!TxtMenuID
& ", " & _
"" & Forms!MoveItem!TxtBasePrice & "," & Forms!MoveItem!CheckTax
& ", " & _
"" & Forms!MoveItem!CheckNoTax & "," &
Forms!MoveItem!CheckInclusive & ")"
Next Spliter

For Spliter = 1 To Forms!SplitPad!TxtDisplay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Loop Returning One Value 6
Looping Code Question 0
SQL Syntax Problem 2
ECHO in the right place? 0

Top