Form Refresh Question???

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

Does the record have to be saved before a form refresh can be done?
Example; I have a main form and on it are sub-forms.
On the main form is a Vendor form and sometimes while the main form is open,
(before saving) I have to add a vendor via another form (Vendors) and then
need to
refresh the sub-form on the main form so it will see the new vendor.
(Me.Refresh) on double click.
My question is, do I need to add code to save the record before the refresh?
 
My question is, do I need to add code to save the record before the
refresh?


I don't think in your case you do, but then again, ANY time I leave a "main"
form with sub-forms, I generally force a disk write.

That way, if you have a lot of forms open, and the pc freezes etc, then no,
or little data is lost.

Also you mention that you go and open the vendor form. If the current form
(main part) does not ref, or use any data/values from the vendors, then once
again you don't really need to force a disk write.

So, right before you launch the vendors form (via some nice handy
button..right??), you go:

me.Refresh ' this forces a disk write
docmd.OpenForm "vendors"

I also assume that vendors is set as "model"...so that the user MUST return
to form vendors after being done...

And, on return, you can either have the "vendors" form re-query the
sub-form, or you can use the forms on-activate event that fires when you
return back to the form. To. "re-load", and -re-query any new records for
the sub-form, you go:


me.MySubForm.Requery
 
You could also write the newvender code into the appropriate control on your
main form before closing it. (assuming that is why you are adding a vender
at this time). Put something like this in the new vender form close
button. NewPOrder is my main form.

If Me.Dirty Then Me.Dirty = False
Form_NewPOrder.cmbVenderID = Me.VenderID
docmd.close

Then after returning to the main form
me.cmbvenderid.refresh
 
Back
Top