Tables are sets, so have no intrinsic order. The concept of 'first' row (not
cell, that's a spreadsheet concept, not a database one) is meaningless in a
table, therefore. You can impose an order by means of query, however, so
lets assume you want to find the first row(s) in MyTable with a Null or
zero-length string in column MyText when a table is ordered by column MyDate.
You can use the TOP option, sorting the rows in date order:
SELECT TOP 1 *
FROM MyTable
WHERE LEN(MyText & "") = 0
ORDER BY MyDate;
Or you can identify the row in question in subquery and return that row in
the outer query like so:
SELECT *
FROM MyTable
WHERE LEN(MyText & "") = 0
AND MyDate =
(SELECT MIN(MyDate)
FROM MyTable
WHERE LEN(MyText & "") = 0);
In form based on the table you could call a function in the form's module:
Private Function FindEmptyMyText()
Dim rst As Object
Set rst = Me.Recordset.Clone
With rst
.FindFirst "Nz(MyText,"""") = """""
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Function
This would find the first matching row in the form's current sort order.
the function could be called from a button for instance by entering as its On
Click event property:
=FindEmptyMyText()
Ken Sheridan
Stafford, England