Form Reloading

M

Mark

Hello,

I have a form that’s has an event “On Loadâ€. Using code how can I get the
form to reload from itself?
I thought
“DoCmd.OpenForm "fmOrdEnt", acNormal, "", "", , acNormalâ€
Would work, but I guess it can’t open something already open.
I also tried
“fmOrdEnt.requery
This doesn’t work either.

That’s for any help!
 
W

Wayne Morgan

What are you trying to accomplish with this? The requery should force the
form to reread the data source as if the form had just opened. For the
requery, try the syntax

Me.Requery

if you are running the code from within the form. If you are running the
code from elsewhere, try

Forms!fmOrdEnt.Requery
 
W

Wayne Morgan

For what you are trying to do, you will need to set the visible property of
the controls. Use the Option's AfterUpdate to turn them on and either the
submit button's Click event or the form's Current event to hide them again.
To check for a new record in the Current event you would use

If Me.NewRecord Then
'Hide them here
Else
'Unhide them here
End If

Using the Else will make them visible if you're wanting to edit an old
record.
 

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