Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Do action or Undo?

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi all,
I need some help in wrting this bit of code please.

On a continous form I have a check box which is used to mark off payments. (PD) The are times when payments have to be reversed. i have put an unbound checkbox in the footer (Cancel) with this code;
Code:
If Cancel Then
 If Cancel Then
  
  Dim rst As DAO.Recordset
  Set rst = Me.Recordset
  With rst
   .MoveFirst
   Undo
     PD = False
      .Edit
     ![PD] = Me![Cancel]
      .Update
      .MoveNext
   Loop Until .EOF


End With

Else

End If

Else
End If

End Sub

What I need this cancel check box to do is to uncheck the bound check box (PD). However it just does the reverse.
I just want the (cancel) check box to uncheck the ones (PD) that have already been checked.

Many thanks,

kp

 
What about:
Code:
   With rst
     .MoveFirst
       If ![PD] Then
         .Edit
         ![PD] = False
          .Update
       End If
     .MoveNext
   Loop Until .EOF
In your code you are setting it to the value of Cancel (which is obviously true).

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Hi traingamer,
Many thanks for your reply.
Tried your code, but it comes up with this error "Loop without Do" (Compile Error)

Not sure what to do next..
Regards,

kp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top