Requerying an unbound form from another form

D

Doug

I have an unbound form frm1. It opens frm2 which opens frm3. frm3 updates
some data fields on frm1 so after the users saves frm3, I want to execute the
current event of frm1 so that it reads the record source again and populates
the form with the most current info. I have tried to frm1.requery from frm3,
but it doesn't execute the current event of frm1 because the form is not
bound (at least that is why I think it doesn't execute it). Any ideas on how
I can do this?
Thanks,
Doug
 
K

Klatuu

You are correct. The Current event does not fire for an unbound form. You
will probably have to do this while in frm3, probably in the Close event:

forms!frm1!SomeControl = Me.FirstControl
forms!frm1!AnotherControl = Me.SecondControl
etc.
 
M

Marshall Barton

Doug said:
I have an unbound form frm1. It opens frm2 which opens frm3. frm3 updates
some data fields on frm1 so after the users saves frm3, I want to execute the
current event of frm1 so that it reads the record source again and populates
the form with the most current info. I have tried to frm1.requery from frm3,
but it doesn't execute the current event of frm1 because the form is not
bound (at least that is why I think it doesn't execute it).


After frm3 saves its data record, just call the procedure in
frm1:

frm3 save procedure:
If Me.Dirty Then Me.Dirty = False
Forms!frm1.Form_Current
 
D

Doug

Is there anyway to execute a event procedure from frm1 from frm3? That way
after I update the record, I could call an event procedure from frm1 to
requery the data.
 
K

Klatuu

How is that going to work, Marshall? First, frm is an unbound form, so it
will not have a dirty property. Not challenging, just trying to learn.
Thanks
 
M

Marshall Barton

I thought frm3 was bound and it was frm1 that was unbound.

Regardless of the mechanism used to save frm3's data, the
code to call a procedure in frm1 is just the standard call
to a method in frm1's class module.
 
J

John Welch

It doesn't necessarily need to be an event procedure you call in frm1 to
refresh its data. You can create your own public function in frm1 that can
be called from anywhere else, eg:
public function refreshMyData() as boolean

'do stuff to refresh data
end function

then you can call frm1.refreshMyData from anywhere
 

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

Similar Threads

Open form - menu 1
Subform asking for Id 1
Why an Insert does not Occur 5
Change data and form crashes Access 3
Referring to another form in code. 1
Form lost focus 7
Requery and Navigation 1
Blank subform 0

Top