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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New record in multiple instance form's subform 1

Status
Not open for further replies.

bradles

Technical User
Sep 15, 2002
110
AU
Here's the scenario:
- Opening multiple instances of a form (frmMultiple)
- frmMultiple contains a TabControl that controls the selection of a subform.
- One of these subforms contains another subform, and it's in that I need to move to a new record.

Problem:
Finding the 'DoCmd.GoToRecord , , acNewRec' not working for me. Can't use the form name as Access beeps "Can't find that object" and otherwise I find movement to a new record on frmMultiple.

Any ideas?

I'd prefer not to add records by DAO/ADO as I'm using some other form record triggers that I'd have to create workarounds.

----------------------------------------------------------
I faithfully promise stars for helpful responses!
 
bradles
You have to set focus to the particular subform first, and then to the new record.

Try something such as...
Code:
Me.Form!YourSubformName.SetFocus
DoCmd.GoToRecord , , acNewRec

Tom
 
Sorry Tom, wasn't clear enough.
As mentioned I cannot set focus to the subform as it lies within a multiple instance form, and trying the 'Me.Form!YourSubformName.SetFocus' or it's variations just doesn't work:

'Access cannot find the object' error.

Any other ideas?
 
bradles
If multiple instances of the same form are open, is there a way of determining which instance you are working on?

In any event, since you are trying to get to a subform within a subform that lies on the main form, I still think you have to drill down to the particular subform you want to use. In order to do that you will have to set focus to the first subform and then to the second subform.

Something like...
Code:
Forms!YourMainFormName!Subform1Name.SetFocus
Forms!Subform1Name!Subform2Name.SetFocus
DoCmd.GoToRecord , ,acNewRec

Tom
 
Yes Tom, keeping track of instances in a collection so I'll try accessing the subforms through that and I'll let you know.

Thanks for pointing me in a new direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top