modify a field value of all the group records

  • Thread starter Thread starter GL
  • Start date Start date
G

GL

Hello

I have seen that on a table given by a query that groups and count
records with field of same values, is not possible to modify a valu
although the field property writes that it is not locked.
Is possible to edit a value on the table and have this value passin
to all the records of the group

Regard

G
 
GL said:
I have seen that on a table given by a query that groups and counts
records with field of same values, is not possible to modify a value
although the field property writes that it is not locked.
Is possible to edit a value on the table and have this value passing
to all the records of the group?


No, not with any built-in capability.

On the other hand, you can do a lot of things with VBA code
and SQL statements.

If you'll explain the situation you working on in more
detail, someone will probably be able to suggest an approach
to accomplish the task.
 
I cannot explain the situation in few words, but I can simply say that the
idea is to find a way to modify simultaneously the record fields of a column
that have the same value.
You can say that due to that, the table seems not to be normalized and this
is true, but I would not like to change the database structure.
I have thought to use an update query and VBA to do it for a group of
records at a time, but I cannot find a way to do it working on a form list
that shows all the grouped record, something that should be more flexible.

GL
 
You're going to need a form, both to provide a user
interface to provide a new value for the grouped field and
as a container for the VBA code to execute an UPDATE query.

For example let's say you have a form that displays the
grouped data field, GroupName, in a text box named txtGroup
and an unbound text box named txtNewGroup where the user can
enter a new value, then the code might be something like:

Dim strSQL As String
strSQL = "UPDATE thetable " _
& "SET GroupName = """ & txtNewGroup & """ " _
& "WHERE GroupName = """ & txtGroup & """ "
CurrentDb.Execute strSQL
 
Thanks Marshall
I'll try it

GL

Marshall Barton said:
You're going to need a form, both to provide a user
interface to provide a new value for the grouped field and
as a container for the VBA code to execute an UPDATE query.

For example let's say you have a form that displays the
grouped data field, GroupName, in a text box named txtGroup
and an unbound text box named txtNewGroup where the user can
enter a new value, then the code might be something like:

Dim strSQL As String
strSQL = "UPDATE thetable " _
& "SET GroupName = """ & txtNewGroup & """ " _
& "WHERE GroupName = """ & txtGroup & """ "
CurrentDb.Execute strSQL
 
Back
Top