G
Guest
Is it possible to reference other records (e.g., the one preceding) in a
calculated field of a query (or by some other means)? This is easy to do in
Excel, but I have not yet figured out whether or how it is possible in
Access. (I'm working in Access 2002.)
For example, I have records of individual fish detections for 2000+ fish.
Fields are: Date, FishID, Location
I would like to create a query that includes a record of a location for
every fish on every day over a three year period. I presently can create a
query that includes a record for every day and every fish (> 2 million
records), but many records have no data for location (i.e., these are days
where a fish was not detected). Thus my desire to reference other records.
In Excel, I would write a formula in a new field that looked at the Location
field. If Location in the present record was blank, it would reference the
location from the previous day/record and fill that in for the present
record. Basically, the fish is assumed to be in the same Location until it
is detected somewhere else. And I want to have a location filled in for
every day in order to create a matrix for use in an
ordination/multi-dimensional statistics program.
I can't use Excel efficiently because of having 2,177,854 records, so I'm
hoping I can figure out a way to do this in Access. There may be another
approach that would solve my immediate problem that is different from what I
have suggested. I'd much appreciate hearing any suggestions, but I'd also
like to know an answer to my initial question as well. I have run across the
desire to reference other records in Access tables/queries many times in the
past.
calculated field of a query (or by some other means)? This is easy to do in
Excel, but I have not yet figured out whether or how it is possible in
Access. (I'm working in Access 2002.)
For example, I have records of individual fish detections for 2000+ fish.
Fields are: Date, FishID, Location
I would like to create a query that includes a record of a location for
every fish on every day over a three year period. I presently can create a
query that includes a record for every day and every fish (> 2 million
records), but many records have no data for location (i.e., these are days
where a fish was not detected). Thus my desire to reference other records.
In Excel, I would write a formula in a new field that looked at the Location
field. If Location in the present record was blank, it would reference the
location from the previous day/record and fill that in for the present
record. Basically, the fish is assumed to be in the same Location until it
is detected somewhere else. And I want to have a location filled in for
every day in order to create a matrix for use in an
ordination/multi-dimensional statistics program.
I can't use Excel efficiently because of having 2,177,854 records, so I'm
hoping I can figure out a way to do this in Access. There may be another
approach that would solve my immediate problem that is different from what I
have suggested. I'd much appreciate hearing any suggestions, but I'd also
like to know an answer to my initial question as well. I have run across the
desire to reference other records in Access tables/queries many times in the
past.