Updating Multiple Records Based on A Single Value (1 Viewer)

forms_are_nightmares

Registered User.
Local time
Today, 07:49
Joined
Apr 5, 2010
Messages
71
Hello.

I've been searching through the threads and couldn't find anything related to my problem. Maybe I'm using the wrong search/key words? If someone knows of a thread, direct me to that as I do not want someone to duplicate work.

What I would like to be able to do is update multiple records based on a user input.

Example:
A user will enter a comment into a record, which can apply to other records in the DB. Rather than have that user re-key or copy and paste the comments, I would like them to be able to open a form, select the records that apply, and have those comments copied to the selected record(s).

Sounds simple and I think I have some ideas in my head but was wondering/hoping if someone has already done this and can help me get this off the ground.

Anyone?

Thanks.
 

bparkinson

Registered User.
Local time
Today, 08:49
Joined
Nov 13, 2010
Messages
158
Assuming the records have unique ID's, and the form exposes which records are checked so you can loop through and get the ID's, SQL like this will do it:

UPDATE tablename SET commentcolumn = commentvariable WHERE ID IN(1,3,5)

A more elegant solution would be to temporarily save the checked records, then have SQL like this:

UPDATE tablename Set commentcolumn = commentvariable WHERE tobeupdatedbit = TRUE

Then have a SQL statement to clear the checked tobeupdatedbit column
 

Users who are viewing this thread

Top Bottom