What is the current record number when inside a UDF?

G

G Lykos

Greetings! Have a UDF spliced into an append query operating from a single
table to fill a calculated field. While watching the data flow through the
UDF to get it to do what is desired, I'd like to know what the current table
record is. Is there a simple way to get that reference (current record
number) inside the UDF?

Thanks,
George
 
M

Marshall Barton

G said:
Greetings! Have a UDF spliced into an append query operating from a single
table to fill a calculated field. While watching the data flow through the
UDF to get it to do what is desired, I'd like to know what the current table
record is. Is there a simple way to get that reference (current record
number) inside the UDF?


There is no such thing as a record number in a table.

Tables are just a bag of unordered data If you want to
impose an order on the data, you must use a query to sort
the records. Once the records are uniquely sortable, you
can then calculate a "ranking" number for each record.
 
G

G Lykos

Marshall, I don't follow your reply. If you open up a table in datasheet
view, there most certainly is a record indicator at the bottom of the view
indicating record x of n as you browse up and down. Further, if you run a
query on the native table, it gets processed in the sequential order of the
datasheet view. Access here, right??

The question was aimed at - when you set up an action query, and it happens
to bomb part way through the table due to the data in a particular data in a
record getting jammed in a UDF, how can you tell from within the UDF what
record it was on?

Let's try again if the scenario makes sense to you, otherwise please skip
it.

Thanks,
George
 
M

Marshall Barton

What you observed in a table's datasheet view is not
guaranteed to be repeatable from one time to another. The
navigation buttons at the bottom of the datasheet window are
calculated behind the scenes using the form's recordset
AbsolutePosition property, which has nothing to do with the
way the data is arranged in its table.

A query processes records in whatever order it thinks is
efficient and only the ORDER BY clause organizes the final
data into the way you see the records.

The proper way to identify a record is by its primary key.
If you pass that as an argument to your UDF, you should be
able to keep track of the record that messed up.
 
G

G Lykos

Thanks!

Marshall Barton said:
What you observed in a table's datasheet view is not
guaranteed to be repeatable from one time to another. The
navigation buttons at the bottom of the datasheet window are
calculated behind the scenes using the form's recordset
AbsolutePosition property, which has nothing to do with the
way the data is arranged in its table.

A query processes records in whatever order it thinks is
efficient and only the ORDER BY clause organizes the final
data into the way you see the records.

The proper way to identify a record is by its primary key.
If you pass that as an argument to your UDF, you should be
able to keep track of the record that messed up.
--
Marsh
MVP [MS Access]


G said:
Marshall, I don't follow your reply. If you open up a table in datasheet
view, there most certainly is a record indicator at the bottom of the view
indicating record x of n as you browse up and down. Further, if you run a
query on the native table, it gets processed in the sequential order of the
datasheet view. Access here, right??

The question was aimed at - when you set up an action query, and it happens
to bomb part way through the table due to the data in a particular data in a
record getting jammed in a UDF, how can you tell from within the UDF what
record it was on?

Let's try again if the scenario makes sense to you, otherwise please skip
it.


"Marshall Barton" wrote through
the
 

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