Re: making record current

Re: making record current

am 01.11.2007 22:15:56 von Bob Quintal

MLH wrote in
news:pvgki35hne7iq9jdbnm5o5a92v0u2tb5u3@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

making record current

am 01.11.2007 22:25:38 von 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

Re: making record current

am 01.11.2007 23:05:08 von Stuart McCall

"MLH" wrote in message
news:pvgki35hne7iq9jdbnm5o5a92v0u2tb5u3@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.

Re: making record current

am 01.11.2007 23:10:58 von OldPro

On Nov 1, 4:25 pm, MLH wrote:
> 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.

Re: making record current

am 02.11.2007 10:23:06 von 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
wrote:

>MLH wrote in
>news:pvgki35hne7iq9jdbnm5o5a92v0u2tb5u3@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.

Re: making record current

am 04.11.2007 07:01:35 von PleaseNOOOsPAMMkallal

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
pleaseNOOSpamKallal@msn.com

Re: making record current

am 04.11.2007 22:39:14 von 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.