VBA Loop through, check condition, replace

jinu4ever

Registered User.
Local time
Today, 19:03
Joined
Sep 19, 2012
Messages
10
Hi all, VBA newbie here

i want to write a vba code to loop through a column in my table and check for a condition, and where it does not equal that condition i want it to display the whole row in a message box and ask to amend the field to meet that condition. If i say Yes i want the amendment to proceed.

For example, the fields would be mostly say 31/08/2012 but one entry may be 30/07/2012. I want the code to pick this out and suggest whether i want to change this to 31/08/2012.

Cheers
A
 
Create a recordset from the table and step through it. Test for the value you want to change and pop up a message box using an IF/THEN construct based on the test. Edit the value in the recordset if the user answers the messagebox with Yes.

If you read the documentation about recordsets and messgeboxes it should be fairly straightforward to write the code.

Post back later if you are struggling and I will provide more detail.
 
See attached db for example of how I would do this.
 

Attachments

Thanks guys! I'll adopt your advice for my database. Will get back to you on how I go!
 
Galaxiom, Bob Fitz

Thanks I've managed to work through my problem with what you've advised.!!
It's perfect for tracking changes to your records where they don't pass the validation.

Appreciated.
 

Users who are viewing this thread

Back
Top Bottom