Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i move to a record in a subform? 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hi,

I'm trying to use a table view of a subform to change the record in another subform in form view.

I thought I could use docmd.GoToRecord, but i'm going round in circles trying to get the syntax right.

Code:
    ID = Me.CurrentRecord
    Forms!contacts.[Fin_Pro subform].Form.GoToRecord , , acGoTo, ID
doesn't work

Nor does
Code:
    ID = Me.CurrentRecord
    Forms!contacts.[Fin_Pro subform].Form.Date_Received.SetFocus
    DoCmd.GoToRecord , , acGoTo, ID

Nor does
Code:
ID = Me.CurrentRecord
DoCmd.GoToRecord acDataForm, "Fin_Pro subform", acGoTo, ID

So what am i doing wrong?

I simply want to be able to move to a record in a table view subform and the form view subform display keep in step and vice versa, so you have two different views of the same data and selecting a record in either one updates the current record in the other.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
OK worked it out.

Code:
        ID = Me.CurrentRecord
        Forms!contacts![Fin_Pro subform].SetFocus
        DoCmd.GoToRecord , , acGoTo, ID


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
and to make sure the form subfrom when adding a new record doesn't cause an error...
Code:
    If Me.CurrentRecord <= Forms!contacts![Fin_Pro subform1].[Form].Recordset.RecordCount Then
        ID = Me.CurrentRecord
        Forms!contacts![Fin_Pro subform1].SetFocus
        DoCmd.GoToRecord , , acGoTo, ID
        [Forms]![contacts]![Fin_Pro subform].SetFocus
        DoCmd.GoToRecord , , acGoTo, ID
    End If

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Thanks for following up on your own issue, since you found/sorted out the solution.
 
no probs, it works great now, had to 'on error resume next' on the other form as it was trying to move to the record before the form had loaded, but that's no biggie!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top