Finding the middle of a table

  • Thread starter Thread starter Maracay
  • Start date Start date
M

Maracay

Hi guys

How can I find the middle of a table,? I am using this instruction
nMiddleOfFile = rs.RecordCount / 2 but is giving be and error, “object
variable or with block variable not foundâ€, an example of what I want to
achieve is: let say the file has 10 records I want 5 as the middle of my file
if the file has 7 records 3 should be the middle of the file

Thanks
 
Maracay said:
How can I find the middle of a table,? I am using this instruction
nMiddleOfFile = rs.RecordCount / 2 but is giving be and error, “object
variable or with block variable not found”, an example of what I want to
achieve is: let say the file has 10 records I want 5 as the middle of my file
if the file has 7 records 3 should be the middle of the file


That should work if you assigned an open recordset object to
rs, but can't tell for sure without seeing the rest of the
procedure.

You probably want to use \ instead of /
 
The error you are getting implies that you have not declared or defined you
rs object. Do you have lines that look similar to the following in your code:

Dim rs as DAO.Recordset
set rs = currentdb.openrecordset("tbl_yourTable")

If not, then that is part of your problem, and Al's recommendation for
determining how many records are in a recordset is a good one.

Just to clarify, tables are not lists, they are more like a bag of marbles,
so there technically is not "middle" of a table, unless you sort the records
based on some criteria.

What do you want to do with this number? Do you want to get some
information that applies to the "middle" record in a sorted list?
--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
Back
Top