Create an UPDATE query:
UPDATE SET Flagged = True WHERE
If you would like to use a recordset just for experience, use something similar to the following in a standard module:
'########### Begin code #########
Dim db as DAO.Database
Dim rs as DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(" ", dbOpenDynaset)
Do Until rs.EOF
If Then
rs.Edit
rs.Flagged = True
rs.Update
End If
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
'######### End of code ######
Darrell
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Jerry Mathers
Sent: Monday, January 28, 2013 11:38 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Cycling through records
I'm stuck on a problem that requires me to cycle through each record in a table looking for certain conditions in specific fields. If I find one of these conditions I need to flag that record (I will probably just put a check in a Yes/No field called Flagged).
The part I cannot figure out is how to cycle through all of the records in a table until I run out of them.
Obviously it to be something like this:
Step 1 Start with the first record
Step 2 Look for the conditions and turn on Flagged when true
Step 3 Move to the next record
Step 4 Look for the conditions and turn on Flagged when true
Step 5 Repeat Steps 3 & 4 until there are no more records
It is Steps 1, 3 & 5 that are my problem. Can you point me in the right direction; maybe a bit of sample code or a website where I might find out how to do this?
Thanks for any help you can provide.
[Non-text portions of this message have been removed]
The information contained in this communication is highly confidential and is intended solely for the use of the individual(s) to whom this communication is directed. If you are not the intended recipient, you are hereby notified that any viewing, copying, disclosure or distribution of this information is prohibited. Please notify the sender, by electronic mail or telephone, of any unintended receipt and delete the original message without making any copies.
Blue Cross Blue Shield of Michigan and Blue Care Network of Michigan are nonprofit corporations and independent licensees of the Blue Cross and Blue Shield Association.
[Non-text portions of this message have been removed]
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar