Refresh subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form which is unbound and a subform which is bound. I make a
selection from a list box of the main form and i see records in subform. In
case that there aren't records, it runs an append query creating them with
null values in some of the fields which user can change later.
The problem is that when query creates records user must make the selection
again to see the records in subform. How can i refresh the subform
automatically?
I run command refresh through a macro but it says that the command or action
refresh isn't available.
 
?????? ???????????? said:
I have a main form which is unbound and a subform which is bound. I
make a selection from a list box of the main form and i see records
in subform. In case that there aren't records, it runs an append
query creating them with null values in some of the fields which user
can change later.
The problem is that when query creates records user must make the
selection again to see the records in subform. How can i refresh the
subform automatically?
I run command refresh through a macro but it says that the command or
action refresh isn't available.

As an alternative to Allen Browne's suggestion -- which should work --
you could simply requery the subform after adding the records. It's not
clear from your description whether the code that runs the append query
is executing on the main form or the subform. My guess is that the code
is on the main form, in which case you would just need to add a
statement of the form

Me!NameOfSubform.Requery

where "NameOfSubform" is the name of the subform control on the main
form, which may or may not be the same as the name of the form object
that the subform control displays.

If the code runs on the subform itself, on the other hand, the statement
to execute would be

Me.Requery
 
Back
Top