472,119 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

making record current

MLH
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
Nov 1 '07 #1
6 2825
MLH <CR**@NorthState.netwrote in
news:pv********************************@4ax.com:
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
You should learn to read the Help files. That'll tell you that the
..bookmark is the one.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 1 '07 #2
"MLH" <CR**@NorthState.netwrote in message
news:pv********************************@4ax.com...
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
Its the bookmark method. The update method updates the database with all
changes made since the AddNew method was called. LastModified means "the
record most recently updated", and setting the recordset's bookmark to that
value causes that record to be the "current" record.

Nov 1 '07 #3
On Nov 1, 4:25 pm, MLH <C...@NorthState.netwrote:
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
The bookmark moves the record pointer to the newly created record.

Nov 1 '07 #4
MLH
I'll try the learning to read suggestion first - then I'll tackle the
HELP files. Thx for the reply.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 01 Nov 2007 21:15:56 GMT, Bob Quintal <rq******@sPAmpatico.ca>
wrote:
>MLH <CR**@NorthState.netwrote in
news:pv********************************@4ax.com :
>Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
You should learn to read the Help files. That'll tell you that the
.bookmark is the one.

--
Bob Quintal

PA is y I've altered my email address.
Nov 2 '07 #5
There is a bit of a quirk with DAO if you add a new record and then update
it, right after you execute the update you lose your record position. To
make this is about the worst flaw in DAO.

Just about everything else about the dao object model is quite fine to me.

So in summary if you find a record, and then update the record the record
pointer remains in place and stays as the current record.

However if you add a *NEW* record then right after the update you lose your
record position, And must use the bookmark to reposition The record point
back to the record we just updated.

I repeat, this only occurs when you've added a new record. For existing
records it's not a problem.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Nov 4 '07 #6
MLH
Interesting point. I must agree, I see no logic
in losing your place after Updating an AddNew.
Would-a-been better to have held the placemark
as a default behavior.
Nov 4 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tony | last post: by
1 post views Thread by 2D Rick | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.