On activate event in modal pop up forms problem

G

Guest

Hello all,
I have a modal pop up form that is calling another modal pop up form.
On both forms the same bound field is visible.
When i change the value of the field in the called form and then close this
form the calling form comes back but it still shows the old value of the
bound field.
Normally i would say...create a on activate event on the calling form and
give a DoCmd.requery in this event.....

but it is not working.........the on activate event is not executed.
A manual DoCmd.requery (on a button) does work.....

(In forms that are not modal pop up the on activate event is working
perfectly...)

Does anyone have an idea how to solve this?
 
G

Guest

Thanks Allen
ok that can be done...but what if you don't know wich form was calling?
It could have been called from one of ten different forms
How to find out wich one did the call?
Could you show me what sourcelines i should use?
 
A

Allen Browne

You can pass the name of the calling form, and the name of the target
control when you open your modal form. Pass the names in the OpenArgs of
OpenForm.

Alternatively, if you want a truly flexible go-anywhere-do-anything-anytime
design, you could use the AfterUpdate and AfterDelConfirm events of each
control to requery any affected controls on any other open form. That's not
as difficult as it sounds: you just call a generic routine from those 2
events of all forms. Then when the application is complete, you write the
generic routine because at that time you are fully aware of the
dependencies.
 
G

Guest

Thanks Allen,
those are good suggestions...
I'm going to try the first one,...the second still seems to difficult (for
me...:)
 
G

Guest

Please help Allen,,,
I am trying to do what you suggested...using the openargs argument, but i
cannot get it working:
In my calling form i used:

DoCmd.OpenForm "CalledFormname", acNormal, , "([fac id] =" & [fac id]
& ")", acFormEdit, acWindowNormal, "Callingformname"

and in the 'stop'-button of the called form i use:

If Not IsNull(Me.OpenArgs) Then
????????? .Requery
End If
DoCmd.Close

what should the ?????? be ? and how to replace the Openargs argument in the
OpenForm statement with a variabel containing the name of the callingform?


Please some help.......
 
A

Allen Browne

This example tests if a name was passed, tests if that form is still open,
and requeries it:

Dim strDoc As String
strDoc = Nz(Me.OpenArgs, vbNullString)
If strDoc <> vbNullString Then
If CurrentProject.AllForms(strDoc).IsLoaded Then
Forms(strDoc).Requery
End If
End If

Assumes Access 2000 or later.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rli said:
Please help Allen,,,
I am trying to do what you suggested...using the openargs argument, but i
cannot get it working:
In my calling form i used:

DoCmd.OpenForm "CalledFormname", acNormal, , "([fac id] =" & [fac
id]
& ")", acFormEdit, acWindowNormal, "Callingformname"

and in the 'stop'-button of the called form i use:

If Not IsNull(Me.OpenArgs) Then
????????? .Requery
End If
DoCmd.Close

what should the ?????? be ? and how to replace the Openargs argument in
the
OpenForm statement with a variabel containing the name of the callingform?


Please some help.......



 

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