update records

M

martin

Is there a way I can update existing records based on the
values I enter on my first record. For example, I have a
form that is pulling data from a query. Some fields are
blank until values are later added in them. The values
that are added will remain the same and I don't want to
keep entering the same info over again. Is there a way I
can just enter the values in the 1st record and then
somehow update the remaining records?
 
J

John Vinson

Is there a way I can update existing records based on the
values I enter on my first record. For example, I have a
form that is pulling data from a query. Some fields are
blank until values are later added in them. The values
that are added will remain the same and I don't want to
keep entering the same info over again. Is there a way I
can just enter the values in the 1st record and then
somehow update the remaining records?

Would it be possible to identify the records which should be updated
using a query with criteria? If so, a simple Update query updating the
field should work. You could do it via a Form but it would take a fair
bit of work - just running an update query (from the form) would seem
to be simpler!
 
G

Guest

John,
What would I put for the "Update to" if I wanted to update
the remaining fields with the value of the first record?
 
J

John Vinson

John,
What would I put for the "Update to" if I wanted to update
the remaining fields with the value of the first record?

Again, a symptom of spreadsheet thinking:

There is no first record.
There is no last record.
A Table HAS NO ORDER. It's an unordered "bag" of data!

What you could do is to look up the first non-null value in the field:
try putting

DLookUp("[fieldname]", "[tablename]", "[fieldname] IS NOT NULL")

on the Update To line (substituting your own field and table names of
course).

One concern here - normally in a relational database, you would not
have a field for which every record has the same value. What's the
structure of your table? Could it perhaps be split into two tables in
a one to many relationship, with this value - once! - in the One side,
and the variable data in the many side table?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top