Moving focus from subform to Parent Form

A

Anne

Hi,
I am trying to move the focus from a subform (Continuous form) to a
control on the parent form.
I have tried the following on the Exit event of the last control in my
subform, but they don't work, if you can help that would be great

me.parent!MyControl.SetFocus
FORMS!MyParentForm!MyControl.SetFocus

They both fire the error 2759

I am working with Access 2003 ADP project.

Thanks for your help

Anne
 
P

Pieter Wijnen

make sure the control is enabled

Dim PF As Access.Form

Set PF = Me.Parent

PF.MyControl.enabled = true
PF.setfocus
PF.MyControl.setfocus

hth

Pieter
 
A

Anne

Hi Pieter,
Same as what I used, I get the error 2759 'The method you tried to
invoke on an object failed.
Any idea why?
 
S

Sylvain Lafontaine

No problem here. I suppose that there is some special condition on your
side. How are you exiting the subform control? Also, can you make a call
to FORMS!MyParentForm!MyControl.SetFocus from other places like a button on
the main form?
 
A

Anne

Hi,
I have a main form with multiple subforms.
FORMS!MyParentForm!MyControl.SetFocus works well with subforms with
Single Form display, however it does not work with subform with
Continuous Form display.

There is no special condition at the moment to exit the subform, as
most of the time the user enter only one record in the continuous
subform. So I would be happy at the moment to exit the subform on the
last control and move back to the main form.

Thanks for your help

Anne
 
S

Sylvain Lafontaine

When I did make my tests earlier, it was already with a continuous subform
as described in your original post; so I cannot tell you anything more on
that based on the current information.

Maybe the version of Access that you are using is making a difference here?

Also, are you really using a continuous subform or the datasheet?
 
R

Raghabendra Sharma

I need to get a list of the recordsources of all the reports in an ADP
database application. In a regular Access database, I could use the
following code to derive the recordsources from reports in a database,
but it does not work with an ADP.

Dim db As Database, doc As Document, con As Container
Set db = DBEngine.Workspaces(0).Databases(0)
Set con = db.Containers("Reports")
Application.Echo False
For i = 0 To con.Documents.Count - 1
Set doc = con.Documents(i)
Debug.Print "Report Name: " & doc.Name
DoCmd.OpenReport doc.Name, A_DESIGN
Debug.Print "RecordSource: " &
Reports(doc.Name).Recordsource
Debug.Print
DoCmd.Close A_REPORT, doc.Name
Next i
Application.Echo True


Does anyone know how to go about doing this same task with an ADP
application? Also, if there are any utilities out there that would let
me interrogate an ADP application I'd love to know of them. I have
used Object Dependency Browser from AADconsulting in the past, but it
doesn't seem to work with ADP. I also downloaded a trial version of
Total Access Detective but it too, does not seem to work with ADP
applications.

Any help would be appreciated.
Raghabendra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top