Subform to MainForm unbound control

  • Thread starter Thread starter Dkline
  • Start date Start date
D

Dkline

My main form has a list box lstPolNum whose row source is
qryPolicyNumberAlpha.

I want to add a set of subforms synchronized by the selection in the list
box. Right now I click on the list box, select a command button for a
report, and I get a report synchronized with the list box selection.

That list box is unbound. When I try to link, I get "Can't build link
between unbound forms".

How can I synchronize these?
 
Since your list box is unbound the only way to "synch" the subforms would be
to have each subform as independent forms (no master/child link) showing
every value in its record source. Then in the AfterUpdate event of the list
box, filter each subform to match the selection, requery each form, then
refresh the subforms.

Why can't the list box be bound?

Kelvin
 
Sorry it's taken so long for me to reply. I got pulled on to a project with
higher priority.

When I bind the control and then attempt to use it, upon click I get the
error message "Control can't be edited; its bound to the expression
[qryPolicyNumAlpha]"

When I originally did this using reports I did create a function that would
do the requery. Each report had a command button to launch it from the form
on the click event.

I suppose that's what I'll have to do here.

What is the corrrect way to setup the list box?

I don't want to edit the record, I just want to make the selection by
clicking on the list box and have the subforms or reports appear based on
the selection on the list box on the main form.
 
You will need to use the AfterUpdate event of the list box like I mentioned
to perform the functions you need. You can change the source of the subform
using

Forms!frmMain!frmSubForm.Form.RecordSource = Forms!frmMain!txtListBox

To open a report use

DoCmd.OpenReport Forms!frmMain!txtListBox

Kelvin

Dkline said:
Sorry it's taken so long for me to reply. I got pulled on to a project with
higher priority.

When I bind the control and then attempt to use it, upon click I get the
error message "Control can't be edited; its bound to the expression
[qryPolicyNumAlpha]"

When I originally did this using reports I did create a function that would
do the requery. Each report had a command button to launch it from the form
on the click event.

I suppose that's what I'll have to do here.

What is the corrrect way to setup the list box?

I don't want to edit the record, I just want to make the selection by
clicking on the list box and have the subforms or reports appear based on
the selection on the list box on the main form.

Kelvin said:
Since your list box is unbound the only way to "synch" the subforms
would
be
to have each subform as independent forms (no master/child link) showing
every value in its record source. Then in the AfterUpdate event of the list
box, filter each subform to match the selection, requery each form, then
refresh the subforms.

Why can't the list box be bound?

Kelvin
 
I simply cannot get this to work.

Main Form = "Program Inventory3"
Sub Form = "Program Inventory Query Crosstab Premium"
ListBox = "List29"

In AfterUpdate for List29, the code is:

Forms![Policy Inventory3]![Program Inventory Query Crosstab
Premium].Form.RecordSource = Forms![Policy Inventory3]!List29

When running I get a Visual Basic message:
Run time error '2580'
The record source '77' specified in the form or report does not exist

The 77 is the value in the bound column of the list box on the main form.

I'm at my wits end.


Kelvin said:
You will need to use the AfterUpdate event of the list box like I mentioned
to perform the functions you need. You can change the source of the subform
using

Forms!frmMain!frmSubForm.Form.RecordSource = Forms!frmMain!txtListBox

To open a report use

DoCmd.OpenReport Forms!frmMain!txtListBox

Kelvin

Dkline said:
Sorry it's taken so long for me to reply. I got pulled on to a project with
higher priority.

When I bind the control and then attempt to use it, upon click I get the
error message "Control can't be edited; its bound to the expression
[qryPolicyNumAlpha]"

When I originally did this using reports I did create a function that would
do the requery. Each report had a command button to launch it from the form
on the click event.

I suppose that's what I'll have to do here.

What is the corrrect way to setup the list box?

I don't want to edit the record, I just want to make the selection by
clicking on the list box and have the subforms or reports appear based on
the selection on the list box on the main form.

Kelvin said:
Since your list box is unbound the only way to "synch" the subforms
would
be
to have each subform as independent forms (no master/child link) showing
every value in its record source. Then in the AfterUpdate event of
the
list
box, filter each subform to match the selection, requery each form, then
refresh the subforms.

Why can't the list box be bound?

Kelvin

My main form has a list box lstPolNum whose row source is
qryPolicyNumberAlpha.

I want to add a set of subforms synchronized by the selection in the list
box. Right now I click on the list box, select a command button for a
report, and I get a report synchronized with the list box selection.

That list box is unbound. When I try to link, I get "Can't build link
between unbound forms".

How can I synchronize these?
 
Back
Top