Re: bookmark

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hallo Philippe

Philippe Malmedé wrote:

Set rs = db.OpenRecordset(sqlbefehl, dbOpenSnapshot)

VarLesezeichen = rs.Bookmark

MsgBox VarLesezeichen

DoCmd.OpenForm "Daten_bearbeiten", acNormal
rs.Bookmark = VarLesezeichen
End Sub

alles klappt nur nicht wenn ich das open form aufmache er automatisch den
letzten aktiven datensatz anspringt sonder er geht immer zum ersten aus
dem sqlbefehl

Der Bookmark ist nur dann identisch, wenn das Recordset identisch ist. Wenn Du den Bookmark von rs verwenden willst, darfst Du das Form nicht ein eigenes Recordset anlegen lassen, auch wenn das SQL Statement idenitsch ist. Du musst dann dem Form das Recordset (rs) zuweisen, damit Du die Bookmarks verwenden kannst.

Setze nach dem Öffnen des Forms dessen Recordset auf rs:
Set Forms("DatenBearbeiten").Recordset = rs

Ich hab's nicht getestet, denke aber, dass dann der Bookmark funktioniert.

Details siehe OH von Access (c) Microsoft, A2007 VBA Help, Topic: Recordset.Bookmark Property:

"[..]If you use the Clone method to create a copy of a Recordset object, the Bookmark property settings for the original and the duplicate Recordset objects are identical and can be used interchangeably. However, you can't use bookmarks from different Recordset objects interchangeably, even if they were created by using the same object or the same SQL statement.[..]"

Gruss
Henry

--
11. AEK Anmeldung unter http://donkarl.com/?AEK
Microsoft MVP Office Access
Keine E-Mails auf Postings in NGs. Danke.
Access FAQ www.donkarl.com

.



Relevant Pages

  • Re: bookmark
    ... DoCmd.GoToRecord acDataForm, "Daten_bearbeiten", acGoTo, varlesezeichen ... Der Bookmark ist nur dann identisch, wenn das Recordset identisch ist. ... Microsoft MVP Office Access ...
    (microsoft.public.de.access)
  • Re: Effects on RST in Calling Proc
    ... >> fail if the recordset itself remains valid. ... The bookmark property is available for the exact purpose ...
    (comp.databases.ms-access)
  • Re: Effects on RST in Calling Proc
    ... >>>FindFirst is a method, whereas a bookmark is a form of data. ... >> same recordset both times, and it has not been requeried. ... volatile piece of data except where it's the only option. ...
    (comp.databases.ms-access)
  • Re: Effects on RST in Calling Proc
    ... fail if the recordset itself remains valid. ... The bookmark property is available for the exact purpose of flagging and returning to a specific record in a recordset. ... FindFirst is a method, whereas a bookmark is a form of data. ... mention was made of a requery. ...
    (comp.databases.ms-access)
  • Re: Effects on RST in Calling Proc
    ... The bookmark property is available for the exact purpose ... >> of flagging and returning to a specific record in a recordset. ... >But we know that a bookmark is volatile data, ... >FindFirst is a method, whereas a bookmark is a form of data. ...
    (comp.databases.ms-access)