updating a subform

  • Thread starter Thread starter placek
  • Start date Start date
P

placek

Hi

It is probably something staring me in the face, though i
would still appreciate a nudge in the right direction.

I have based a subform on a table. When a check box is
clicked the program requests data, that it then puts in
the underlying table. The problem is that the subform is
not updated dynamically. Believe it or not the only way i
can get the subform to update is by going into Design view
and then back into form view.

Obviously this would be unworkable in reality, so can
someone please let me know how to update the sub form in
real time. Thanks.

Martin
 
Requery will bring the data into the form, but it will reset to the first
record.

The alternative is to add the record to the form's RecordsetClone instead of
directly to the table.
 
Thanks Allen, i thought i would have to use the requery
method. However, when i use the following code to requery
the subform i get an error.

Dim subform as subform

set subform=me

me.requery

Can you tell me what is wrong with the above procedure
(found in the subform module)?
 
There is a difference between a subform control and the form in that
control.

The "subform" type refers to a subform control.
"Me" refers to the form (class module actually).
Therefore you cannot assign a subform control the object that is the form.
(Additionally you cannot create a variable named "subform" since it is a
special word.)

To requery a subform from its own module, just use:
Me.Requery
as "Me" is already provided for you.

If you need to requery it from the main form, try:
Me.[YourSubformControlHere].Form.Requery
More information on that syntax:
http://allenbrowne.com/casu-04.html
 
Thanks, Allen. Works like a treat!

-----Original Message-----
There is a difference between a subform control and the form in that
control.

The "subform" type refers to a subform control.
"Me" refers to the form (class module actually).
Therefore you cannot assign a subform control the object that is the form.
(Additionally you cannot create a variable named "subform" since it is a
special word.)

To requery a subform from its own module, just use:
Me.Requery
as "Me" is already provided for you.

If you need to requery it from the main form, try:
Me.[YourSubformControlHere].Form.Requery
More information on that syntax:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks Allen, i thought i would have to use the requery
method. However, when i use the following code to requery
the subform i get an error.

Dim subform as subform

set subform=me

me.requery

Can you tell me what is wrong with the above procedure
(found in the subform module)?


though
i way
i


.
 
Back
Top