Code Help

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub
 
Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub
 
Ofer said:
Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:

I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub
Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS
 
There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

DS said:
Ofer said:
Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:

I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub
Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS
 
Ofer said:
There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:

Ofer said:
Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:



I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS
Ok. The Taxed field is in the subform. I'll play with your
suggestions! Be right back.
Thanks
DS
 
Ofer said:
There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:

Ofer said:
Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:



I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS
Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS
 
Now you should move the End if Back before the Loop.

DS said:
Ofer said:
There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:

Ofer wrote:

Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:



I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub


Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS
Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS
 
Ofer said:
Now you should move the End if Back before the Loop.

:

Ofer wrote:

There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:



Ofer wrote:


Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:




I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub


Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS

Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS
That Worked! Almost. Here is what I have, the problem now is, when I
don't have any Taxed = True it freezes the computer. Must be missing
Something.
Thanks
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

I moved the Location thing to be taken care of elsewhere. That should
make it easier.
 
Move the .movenext after the end if


DS said:
Ofer said:
Now you should move the End if Back before the Loop.

:

Ofer wrote:


There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:



Ofer wrote:


Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:




I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub


Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS


Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS
That Worked! Almost. Here is what I have, the problem now is, when I
don't have any Taxed = True it freezes the computer. Must be missing
Something.
Thanks
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

I moved the Location thing to be taken care of elsewhere. That should
make it easier.
 
Ofer said:
Move the .movenext after the end if


:

Ofer said:
Now you should move the End if Back before the Loop.

:



Ofer wrote:



There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:




Ofer wrote:



Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:





I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub


Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS


Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS

That Worked! Almost. Here is what I have, the problem now is, when I
don't have any Taxed = True it freezes the computer. Must be missing
Something.
Thanks
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

I moved the Location thing to be taken care of elsewhere. That should
make it easier.
That worked, but the prblems continue, I added code to send it back, but
heres the problem it ONLY WORKS when theres a Taxed = True at the
begining. If I have the Taxed = True after the items that need changing
then nothing happens.
Thanks
DS
 
Post the code again, and by the way you didnt put the criteria of the
Location in the IF statement , you put only the TAX

DS said:
Ofer said:
Move the .movenext after the end if


:

Ofer wrote:

Now you should move the End if Back before the Loop.

:



Ofer wrote:



There are somethings which I dont understand
1. The move first should be before the loop
2. Is the Taxed is a field in the sub form, if so you should give the all
path.
Forms![MainFormName].[SubName].Form![Fieldname]
3. the same path for the location
4. Shouldnt you check the value of the fields in the loop and not before the
loop?


Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst '
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:




Ofer wrote:



Hey DS
The End if should be after the loop

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With
End Sub

:





I've got this code to loop through records. It almost works. The
criteria is if Location = "Bar" and if any records have Taxed=True
Then SDInclusive = False
and SDTaxed = True...
If not nothing happens...while, I got the nothing part!!!
Any help..I would appreciate.
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
If Forms!Sales.SalesDetails![Location] = "Bar" And Taxed = True Then
Do While .EOF = False
.MoveFirst
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub


Hi Ofer
It doesn't work. Both of the conditions were met....Location=Bar and I
had a record where Taxed = True. But the code just sat there.
Thanks
DS


Here's what I came up with....when I run it I get a Loop without Do.
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms!Sales.SalesDetails.Form![Location] = "Bar" And
Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
Loop
End If
End With

Thanks
DS



That Worked! Almost. Here is what I have, the problem now is, when I
don't have any Taxed = True it freezes the computer. Must be missing
Something.
Thanks
DS

Private Sub Command75_Click()
With Forms!Sales.SalesDetails.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
If Forms![Sales].[SalesDetails].Form!Taxed = True Then
.Edit
!SDInclusive = False
!SDTaxed = True
.Update
.MoveNext
End If
Loop
End With
End Sub

I moved the Location thing to be taken care of elsewhere. That should
make it easier.
That worked, but the prblems continue, I added code to send it back, but
heres the problem it ONLY WORKS when theres a Taxed = True at the
begining. If I have the Taxed = True after the items that need changing
then nothing happens.
Thanks
DS
 
Back
Top