Sync forms

S

SAC

I have two form's I'm trying to sync. One datasheet and one single.

Private Sub Form_Current()

[Forms]![frmLookup]![frmOrderStatusDatesSF].Requery
[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Repaint

End Sub

frmLookup is a main form with no datasource. Combo boxes and buttons on it
are used for searching.

the current form is the datasheet one.

[Forms]![frmLookup]![frmOrderStatusDatesSF] is the single record form and
it's data source is a query with criteria pointing to the datasheet form so
that when the current record on the datasheet form changes, the detail in
the songle form changes.

Thought I could just requery and refresh the single form but I get an error.
The requery does not give an error, but the refresh does. It says:

"You entered and expression that has an invalid reference to the property
Form/Report."

Any ideas on how to fix this?

Thanks.
 
R

Rick Brandt

SAC said:
I have two form's I'm trying to sync. One datasheet and one single.

Private Sub Form_Current()

[Forms]![frmLookup]![frmOrderStatusDatesSF].Requery
[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Repaint

End Sub

frmLookup is a main form with no datasource. Combo boxes and buttons on it
are used for searching.

the current form is the datasheet one.

[Forms]![frmLookup]![frmOrderStatusDatesSF] is the single record form and it's
data source is a query with criteria pointing to the datasheet form so that
when the current record on the datasheet form changes, the detail in the
songle form changes.

Thought I could just requery and refresh the single form but I get an error.
The requery does not give an error, but the refresh does. It says:

"You entered and expression that has an invalid reference to the property
Form/Report."

Any ideas on how to fix this?

I suspect that a subform does not do "repaint" but is at the whim of the parent
form's painting. You shouldn't need a repaint anyway. I would just try...

[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Requery
 
S

SAC

Thanks. This gives the same error.

Just to make sure I communicated the situation correctly: I've got a main
form and two forms on it...one datasheet and one single form. Main form has
no data source... drop down boxes on it are just used to set datasource for
the datasheet form.

I'd like the on_current event for the datasheet form to update and display
the data on the single form.

Thanks for your help.


Rick Brandt said:
SAC said:
I have two form's I'm trying to sync. One datasheet and one single.

Private Sub Form_Current()

[Forms]![frmLookup]![frmOrderStatusDatesSF].Requery
[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Repaint

End Sub

frmLookup is a main form with no datasource. Combo boxes and buttons on
it are used for searching.

the current form is the datasheet one.

[Forms]![frmLookup]![frmOrderStatusDatesSF] is the single record form and
it's data source is a query with criteria pointing to the datasheet form
so that when the current record on the datasheet form changes, the detail
in the songle form changes.

Thought I could just requery and refresh the single form but I get an
error.
The requery does not give an error, but the refresh does. It says:

"You entered and expression that has an invalid reference to the property
Form/Report."

Any ideas on how to fix this?

I suspect that a subform does not do "repaint" but is at the whim of the
parent form's painting. You shouldn't need a repaint anyway. I would
just try...

[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Requery
 
R

Rick Brandt

SAC said:
Thanks. This gives the same error.

Just to make sure I communicated the situation correctly: I've got a
main form and two forms on it...one datasheet and one single form. Main
form has no data source... drop down boxes on it are just used
to set datasource for the datasheet form.

I'd like the on_current event for the datasheet form to update and
display the data on the single form.

Thanks for your help.


That suggests that you have the name wrong. In this expression...

[Forms]![frmLookup]![frmOrderStatusDatesSF].Form.Repaint

...."frmOrderStatusDatesSF" needs to be the name of the subform *control*.
That will often be the same as the name of the form being displayed within,
but that is not guaranteed. My guess is that in your case the name of the
control is different.
 

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