Refresh form while Open

F

Fox

I have a form(form1) that has a button that opens another form(form2) which
is dependent on data from form1.
Is there a way to refresh the data on form2 if the user leaves form2 open
while moving to a new record on form1?
 
J

Jeff Boyce

Not sure why you have new forms popping open and closed, just to show
'dependent' data.

Take a look at the "main form/subform" construction in Access. The data
you have in form1 (i.e. the "main form") will cause the related (dependent)
records to be displayed in the subform (what you now use a separate
popped-up form to show).

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
F

Fox

form2 is not a subform...it is actually a sort of calculator and doesn't have
a table behind it. The information on form2 is not needed nor does it
populate any data on form1, and is only a reference. form2 does not populate
any fields on form1, it only gives suggestions as to how a field might be
populated. So user can click the button to open form2 and certain data from
form1 is populated in a few fields in form2 so that a calculation can be
made. The problem comes into play because user may not close form2 and then
might move to the next record on form1, in this case form2 is still
displaying fields values from form1.
I hope I'm typing my explaination so that it is understandable....
 
J

Jeff Boyce

It sounds like you wish form2 to close when you leave it. Have you looked
into using the LostFocus event of that form?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
F

Fox

Yes that would be the best solution I did try in the LostFocus event of form2
DoCmd.Close
but this did not cause the form to close when the next record was selected
on form1.
 
J

Jeff Boyce

I'm not following.

Where did you put the DoCmd.Close?

If form2 was closed, how does it appear again "when the next record was
selected on form1"?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
F

Fox

Well I put the DoCmd.Close acForm, "FormName" in several places actually,
have been working on it for hours since I couldn't figure out how to refresh
the form info. I finally put it in the Current event by suggestion and that
worked. It is so amazing how the same command will work differently on
different db's...sometimes it just drives me bonkers...
Thanks so much for your help it is much apprieciated!
 

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