Bookmarks and new records

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi

I am assisting in the development of a system where one of the desing goals
is:

In form 'Family' the user can click an Add New Adult button and view form
'Adult', in Add mode (just the tentative append record showing), or select
an Adult and click on details and open the 'Adult' form filtered to just the
selected adult

After adding some keys details in the 'Adult' form the user can then click
to add an address, which opens the 'address' form again in Add mode.

After completing an address, closing the address form automatically updates
an address subform (which displays key details of the address) on the Adult
form.

To get the address subform (on the adult form) to requery correctly I need
to requery the adult form, thus moving from the current record.

I use a bookmark to 'remember' the record that the user was previously
viewing and relocate and display that record. This causes problems if the
Adult form was opened in Add mode. Although I save the record and then store
the bookmark, after a requery the bookmark can't be found.

I can get around this by initially opening the Adult form in Edit mode and
then moving to a new record, but this is not exactly what has been
requested.

Any ideas as to how I can move the record I was working on previously? The
code is generic and so I am trying to avoid storing the primary key and then
looking for records that match as this will be less flexible than
bookmarking if I can find a way to get that to work.

TIA

Paul
 
-----Original Message-----

To get the address subform (on the adult form) to requery correctly I need
to requery the adult form, thus moving from the current record.

I use a bookmark to 'remember' the record that the user was previously
viewing and relocate and display that record. This causes problems if the
Adult form was opened in Add mode. Although I save the record and then store
the bookmark, after a requery the bookmark can't be found.

I can get around this by initially opening the Adult form in Edit mode and
then moving to a new record, but this is not exactly what has been
requested.

Any ideas as to how I can move the record I was working on previously? The
code is generic and so I am trying to avoid storing the primary key and then
looking for records that match as this will be less flexible than
bookmarking if I can find a way to get that to work.

TIA

Paul
Hi Paul,
a bookmark is a recordset position. When you requery the
form recordsource, you recreate the recordset. This also
can by definition reposition records from one recordset to
another.

You could try using

strCriteria="[identifying field usually primary key]=" &
txtFieldControlName
me.recordsetclone.findfirst strCriteria
me.bookmark=me.recordsetclone.bookmark

to move to the desired record after a requery.

Luck
Jonathan
 
I am assisting in the development of a system where one of the desing goals
is:

In form 'Family' the user can click an Add New Adult button and view form
'Adult', in Add mode (just the tentative append record showing), or select
an Adult and click on details and open the 'Adult' form filtered to just the
selected adult

After adding some keys details in the 'Adult' form the user can then click
to add an address, which opens the 'address' form again in Add mode.

After completing an address, closing the address form automatically updates
an address subform (which displays key details of the address) on the Adult
form.

To get the address subform (on the adult form) to requery correctly I need
to requery the adult form, thus moving from the current record.


Try just requerying the subform instead of the main form.

Me.subformcontrol.Form.Requery
 
Try just requerying the subform instead of the main form.

I did that, but it seemed that if the main form was not requeried, the
subform would not pick up the new records.
 
Thanks Jon,

I am coming to the conclusion that I will have to do this based on primary
key, or do what I am doing now and open the form in edit mode (as that works
OK).

I had wanted to avoid this (use of primary key) as this is generic code used
on about a half dozen screens in this system and that I hope to use in
future systems to cut development time. The primary key is *usually*
fields(0) so I can use that (and add an optional parameter to specify a
different field) to move back to the record or set a filter, but a recordset
solution would have been nicer.

Cheers

Paul


Jonathan Parminter said:
-----Original Message-----

To get the address subform (on the adult form) to requery correctly I need
to requery the adult form, thus moving from the current record.

I use a bookmark to 'remember' the record that the user was previously
viewing and relocate and display that record. This causes problems if the
Adult form was opened in Add mode. Although I save the record and then store
the bookmark, after a requery the bookmark can't be found.

I can get around this by initially opening the Adult form in Edit mode and
then moving to a new record, but this is not exactly what has been
requested.

Any ideas as to how I can move the record I was working on previously? The
code is generic and so I am trying to avoid storing the primary key and then
looking for records that match as this will be less flexible than
bookmarking if I can find a way to get that to work.

TIA

Paul
Hi Paul,
a bookmark is a recordset position. When you requery the
form recordsource, you recreate the recordset. This also
can by definition reposition records from one recordset to
another.

You could try using

strCriteria="[identifying field usually primary key]=" &
txtFieldControlName
me.recordsetclone.findfirst strCriteria
me.bookmark=me.recordsetclone.bookmark

to move to the desired record after a requery.

Luck
Jonathan
 
Back
Top