From: mcnews on
2 questions:

why does the code below work (sorta) for my Form_Click() method but
not for my Form_Current() method?

Dim rstData As DAO.Recordset
Set rstData = Forms!aMain.Form.RecordsetClone
rstData.FindFirst "RecordPointer = " & RecordPointer
Forms!aMain.Form.Bookmark = rstData.Bookmark
Set rstData = Nothing

the onclick is invoked when a row is clicked. on first click the
record pointer moves to the first record so i have to click it again.

the oncurrent is invoked when the record navigator moves to the next
record. i then get a 'Method 'Bookmark' of object '_Form_aMain'
failed.

any clues?
the subform is in Datasheet view.
From: Klatuu on
Can't figure out from your code what it is you are really trying to do.
One problem you have is your object referencing is incorrect and may be
confusing Access:
Forms!aMain.Form.RecordsetClone
If you are trying to address the RecordsetClone of your subform using this,
and aMain is the name of a subform control on the current form, then it sould
be:
Me!aMain.Form.RecordsetClone.

Can you describe what you are trying to achive? There may be a better way.
--
Dave Hargis, Microsoft Access MVP


"mcnews" wrote:

> 2 questions:
>
> why does the code below work (sorta) for my Form_Click() method but
> not for my Form_Current() method?
>
> Dim rstData As DAO.Recordset
> Set rstData = Forms!aMain.Form.RecordsetClone
> rstData.FindFirst "RecordPointer = " & RecordPointer
> Forms!aMain.Form.Bookmark = rstData.Bookmark
> Set rstData = Nothing
>
> the onclick is invoked when a row is clicked. on first click the
> record pointer moves to the first record so i have to click it again.
>
> the oncurrent is invoked when the record navigator moves to the next
> record. i then get a 'Method 'Bookmark' of object '_Form_aMain'
> failed.
>
> any clues?
> the subform is in Datasheet view.
>
From: mcnews on
On Jun 27, 10:22 am, Klatuu <Kla...(a)discussions.microsoft.com> wrote:
> Can't figure out from your code what it is you are really trying to do.
> One problem you have is your object referencing is incorrect and may be
> confusing Access:
> Forms!aMain.Form.RecordsetClone
> If you are trying to address the RecordsetClone of your subform using this,
> and aMain is the name of a subform control on the current form, then it sould
> be:
> Me!aMain.Form.RecordsetClone.
>
> Can you describe what you are trying to achive? There may be a better way.
> --
> Dave Hargis, Microsoft Access MVP
>
> "mcnews" wrote:
> > 2 questions:
>
> > why does the code below work (sorta) for my Form_Click() method but
> > not for my Form_Current() method?
>
> > Dim rstData As DAO.Recordset
> > Set rstData = Forms!aMain.Form.RecordsetClone
> > rstData.FindFirst "RecordPointer = " & RecordPointer
> > Forms!aMain.Form.Bookmark = rstData.Bookmark
> > Set rstData = Nothing
>
> > the onclick is invoked when a row is clicked. on first click the
> > record pointer moves to the first record so i have to click it again.
>
> > the oncurrent is invoked when the record navigator moves to the next
> > record. i then get a 'Method 'Bookmark' of object '_Form_aMain'
> > failed.
>
> > any clues?
> > the subform is in Datasheet view.

i inherited this app so there is some goofy stuff that i won't have
time to fix.
the parent form is called aMain the has a bound table called
specimens. it contains a tab control with 4 tabs. the 3rd tab has a
subform in datasheet view that is also bound to the specimen table. i
know this isn't good, but i can't change it. users need to be able to
edit specimens, but only certain fields. so i use the control on the
3rd tab that are bound to the specimen table for editing. so i am
using an autonumber field from the specimen row on the subform to keep
the record on the main form in sync.
i am sure this doesn't make sense, but i have to make it work as is.
From: Klatuu on
Okay, then to get your syntax correct, it should me
Me!NameOfSubFormControl.Form.RecordsetClone
NameOfSubFormControl is the name of the subform control on tab 3, not the
name of the form being used as a subform.

But, you really don't need to do that and no code is required.

A subform control has two properties that will do it for you. They are the
Link Master Field(s) and Link Child Field(s) properties. You put the name of
the field in the main form's recordset that relates to the to subform's
recordset in the Link Master Field(s) property and the name of the field in
subform's recordset that relates to the main form's recordset. That way,
each time you move to a different record in the main form, the records in the
subform that relate to the current record in the main form will be the only
records displayed.
--
Dave Hargis, Microsoft Access MVP


"mcnews" wrote:

> On Jun 27, 10:22 am, Klatuu <Kla...(a)discussions.microsoft.com> wrote:
> > Can't figure out from your code what it is you are really trying to do.
> > One problem you have is your object referencing is incorrect and may be
> > confusing Access:
> > Forms!aMain.Form.RecordsetClone
> > If you are trying to address the RecordsetClone of your subform using this,
> > and aMain is the name of a subform control on the current form, then it sould
> > be:
> > Me!aMain.Form.RecordsetClone.
> >
> > Can you describe what you are trying to achive? There may be a better way.
> > --
> > Dave Hargis, Microsoft Access MVP
> >
> > "mcnews" wrote:
> > > 2 questions:
> >
> > > why does the code below work (sorta) for my Form_Click() method but
> > > not for my Form_Current() method?
> >
> > > Dim rstData As DAO.Recordset
> > > Set rstData = Forms!aMain.Form.RecordsetClone
> > > rstData.FindFirst "RecordPointer = " & RecordPointer
> > > Forms!aMain.Form.Bookmark = rstData.Bookmark
> > > Set rstData = Nothing
> >
> > > the onclick is invoked when a row is clicked. on first click the
> > > record pointer moves to the first record so i have to click it again.
> >
> > > the oncurrent is invoked when the record navigator moves to the next
> > > record. i then get a 'Method 'Bookmark' of object '_Form_aMain'
> > > failed.
> >
> > > any clues?
> > > the subform is in Datasheet view.
>
> i inherited this app so there is some goofy stuff that i won't have
> time to fix.
> the parent form is called aMain the has a bound table called
> specimens. it contains a tab control with 4 tabs. the 3rd tab has a
> subform in datasheet view that is also bound to the specimen table. i
> know this isn't good, but i can't change it. users need to be able to
> edit specimens, but only certain fields. so i use the control on the
> 3rd tab that are bound to the specimen table for editing. so i am
> using an autonumber field from the specimen row on the subform to keep
> the record on the main form in sync.
> i am sure this doesn't make sense, but i have to make it work as is.
>
From: mcnews on
On Jun 27, 10:53 am, Klatuu <Kla...(a)discussions.microsoft.com> wrote:
> Okay, then to get your syntax correct, it should me
> Me!NameOfSubFormControl.Form.RecordsetClone
> NameOfSubFormControl is the name of the subform control on tab 3, not the
> name of the form being used as a subform.
>
> But, you really don't need to do that and no code is required.
>
> A subform control has two properties that will do it for you. They are the
> Link Master Field(s) and Link Child Field(s) properties. You put the name of
> the field in the main form's recordset that relates to the to subform's
> recordset in the Link Master Field(s) property and the name of the field in
> subform's recordset that relates to the main form's recordset. That way,
> each time you move to a different record in the main form, the records in the
> subform that relate to the current record in the main form will be the only
> records displayed.
> --
> Dave Hargis, Microsoft Access MVP
>
> "mcnews" wrote:
> > On Jun 27, 10:22 am, Klatuu <Kla...(a)discussions.microsoft.com> wrote:
> > > Can't figure out from your code what it is you are really trying to do.
> > > One problem you have is your object referencing is incorrect and may be
> > > confusing Access:
> > > Forms!aMain.Form.RecordsetClone
> > > If you are trying to address the RecordsetClone of your subform using this,
> > > and aMain is the name of a subform control on the current form, then it sould
> > > be:
> > > Me!aMain.Form.RecordsetClone.
>
> > > Can you describe what you are trying to achive? There may be a better way.
> > > --
> > > Dave Hargis, Microsoft Access MVP
>
> > > "mcnews" wrote:
> > > > 2 questions:
>
> > > > why does the code below work (sorta) for my Form_Click() method but
> > > > not for my Form_Current() method?
>
> > > > Dim rstData As DAO.Recordset
> > > > Set rstData = Forms!aMain.Form.RecordsetClone
> > > > rstData.FindFirst "RecordPointer = " & RecordPointer
> > > > Forms!aMain.Form.Bookmark = rstData.Bookmark
> > > > Set rstData = Nothing
>
> > > > the onclick is invoked when a row is clicked. on first click the
> > > > record pointer moves to the first record so i have to click it again.
>
> > > > the oncurrent is invoked when the record navigator moves to the next
> > > > record. i then get a 'Method 'Bookmark' of object '_Form_aMain'
> > > > failed.
>
> > > > any clues?
> > > > the subform is in Datasheet view.
>
> > i inherited this app so there is some goofy stuff that i won't have
> > time to fix.
> > the parent form is called aMain the has a bound table called
> > specimens. it contains a tab control with 4 tabs. the 3rd tab has a
> > subform in datasheet view that is also bound to the specimen table. i
> > know this isn't good, but i can't change it. users need to be able to
> > edit specimens, but only certain fields. so i use the control on the
> > 3rd tab that are bound to the specimen table for editing. so i am
> > using an autonumber field from the specimen row on the subform to keep
> > the record on the main form in sync.
> > i am sure this doesn't make sense, but i have to make it work as is.

as i said, the main form and subform are bound to the same table.
screwed up, i know, but that's what i got. i know about link fields.
they are doing what they're supposed to.