bookmark problem

  • Thread starter Thread starter Andreas Wöckl
  • Start date Start date
A

Andreas Wöckl

Hi!

I have the following problem in my access form:

for example I use a form to display overview data (all employes of a
company) - with a button I go to a detail mode to edit the data - when i
close this form i want to

1.) refresh the overview
2.) set a bookmark to go to the data sentence I have edited

my code on closing the form:

Public Sub reloadForm(ByVal formName)
If IsLoaded(formName) Then
Forms(formName).Bookmark.requery
Forms(formName).Bookmark = globBookmark
End If
End Sub

Without doing the requery I am able to go to de sentence - but the data is
not refreshed..

Can anyone help me?

best regards,

andreas wöckl
 
I found out the hard way that the requery wrecks your bookmarks. The best
way appears to be to save the current ID, eg the primary key for the record,
then do a FindFirst on the form recordsetclone to go back to the same ID.
And you still have to handle the case where that record was deleted, in
which case the Find fails.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
I am in a shame but the code I posted wos wrong - of course i do the
following:

Forms(formName).requery

The method with searching for the primary key of course would work - but i
would like to create a method that works in every case - without knowing
which primary key or fields are used

any ideas?

regards

andreas wöckl
 
I dont know any general solution. You as the designer and coder have to
know the field names, so you just have to insert the correct key field name
in the search.

I guess you could use the database properties to find the primary key field
for the table, and then search using that name, but you still need to know
the name of the table.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
Back
Top