Subform not empty

G

Gianluigi

I have a form (Access 2000) with a combo used to choice a value
necessary to filter the data displayed in a subform. Every time I open
the form, the subform is not empty but displays the data corresponding
to the last value selected in the combo the preceding time I used the
form. What I have to do to obtain that when I open the form the subform
is empty ?
Thank you

Gianluigi
 
M

Maarkr

One thing that may work depending on what you want is to clear out the combo
after selection. In the After Update event of the combo, after any other
code, put something like Me.Combo99 = Null
 
G

Gianluigi

Il 06/04/2010 12.58, KenSheridan via AccessMonster.com ha scritto:
Gianluigi:

You don't say how you are filtering the subform, but I'd suggest you do it
like this:

1. The combo box in the parent form should be unbound, i.e. its
ControlSource property is left blank.

2. The subform control's LinkMasterFields property should be the name of the
combo box in the parent form.

3. The subform control's LinkChildFields property should be the name of the
field in the subform's underlying table or query on which it is to be
filtered.

4. The subform's RecordSource should be a table or query which would return
all rows if opened independently of the subform.

This should filter the subform to the item selected in the combo box, or to
no items if the combo box is Null, as it will be when the parent form is
opened.

Ken Sheridan
Stafford, England
To filter the data in the subform I used this code:

Private Sub CmbSceltaProgetto_AfterUpdate()
DoCmd.ApplyFilter , "IDProgetto = " &
Forms!Filtro_Progetto!CmbSceltaProgetto
End Sub

In both the subform control's LinkMasterFields and LinkChildFields
property I used the value of the field selected in the combo.
Now I have deleted the code for the after update event of the combo and
modified the property of LinkMasterFields and LinkChildFields as you
suggested and it works ...

Thank you,

Gianluigi
 
G

Gianluigi

Il 06/04/2010 13.15, Maarkr ha scritto:
One thing that may work depending on what you want is to clear out the combo
after selection. In the After Update event of the combo, after any other
code, put something like Me.Combo99 = Null
In the structure I had (now I have changed as suggested by Ken
Sheridan), I used the event After Update to filter the data.

Thank you,

Gianluigi
 

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