Tom,
thanks for the encouragment!
The code snippent caused a not found bookmark error. The code below does the
trick.
'*****start***
Dim rs As DAO.Recordset ' assuming DAO
Dim lngPrimaryKeyValue As Long
lngPrimaryKeyValue = Me.ContactID ' assuming you have a long
Me!PositionClosingDate = Date 'no need for Format, unless you're a
Set rs = Me.RecordsetClone
rs.FindFirst "ContactID=" & lngPrimaryKeyValue
If Not rs.NoMatch Then
If rs.BOF Then
' the one we were on is the first record. Can't MovePrevious.
rs.MoveNext
Me.Bookmark = rs.Bookmark
Else
rs.MovePrevious
Me.Bookmark = rs.Bookmark 'Sync the form with the recordset.
End If
End If
lngPrimaryKeyValue = Me.ContactID ' assuming you have a long
Me.Requery 'integer primary key
rs.FindFirst "ContactID=" & lngPrimaryKeyValue
Me.Bookmark = rs.Bookmark 'Sync the form with the recordset.
rs.Close 'Purists don't do this.
Set rs = Nothing
'****end****
"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:tj********************************@4ax.com...
On Fri, 7 Nov 2003 13:00:56 +1100, "Norman Fritag"
<mt*****@ozemail.com.au> wrote:
Me.Requery requeries the underlying query, which resets the current
record to the first record.
To go to the record before the one you were on, you would have to
write code similar to this:
dim rs as recordset ' assuming DAO
dim lngPrimaryKeyValue as long
Me!PositionClosingDate = Date 'no need for Format, unless you're a
bad boy and using Text field rather than DateTime field.
lngPrimaryKeyValue = Me!PrimaryKeyField ' assuming you have a long
integer primary key
Me.Requery
set rs=me.recordsetclone
rs.FindFirst "PrimaryKeyField=" & lngPrimaryKeyValue
if not rs.nomatch then
if rs.bof then
' the one we were on is the first record. Can't MovePrevious.
else
rs.moveprevious
me.bookmark = rs.bookmark 'Sync the form with the recordset.
endif
endif
rs.close 'Purists don't do this.
set rs=nothing
-Tom.
Hi there,
On a form I click a tickbox ("display",yes/No) that requires the
recordset.=>>Code<<--
Me!PositionClosingDate = Format(Date, "Short Date") ' when was the
positionclosed?
Me.Requery ' underlining query is set to display only records where
Closeposition is set to zero 0
This works sofar Ok.
I would like on the form to display the previous record not as its now,
whereas after the recordset is required the forms recordnumber = 1.
any Ideas that point me into the right direction?
kind regards
Norman