Requery problem

T

Tcs

I have a form with a subform. The form has two combo boxes, and the subform is
a continuous form to display the records that the two combo boxes select.

I seem to have the combo boxes working except for:

Combo box 2 only correctly shows what it should after opening the form. If I go
back to combo box 1 again, then back to combo box 2, it still shows what it had
from the first time I went to it.

Combo box 1 uses a query:

SELECT DISTINCT
[tblSubModules].[MetaSchema],
[tblApplications].[Application]

FROM
tblSubModules
INNER JOIN
tblApplications
ON
([tblSubModules].[CatalogVers]=[tblApplications].[CatalogVers]) AND
([tblSubModules].[MetaSchema]=[tblApplications].[MetaSchema])
ORDER BY
[tblSubModules].[MetaSchema], [tblApplications].[Application];

As does combo box 2:

SELECT DISTINCT
tblSubModules.CatalogVers,
tblSubModules.MetaSchema

FROM
tblSubModules
WHERE
(((tblSubModules.MetaSchema)=[Forms]![frmSubModules].[MetaSchema]))
ORDER BY
tblSubModules.CatalogVers, tblSubModules.MetaSchema;


And the requery?

No compiler errors, but nothing happens either. Once it appeared that the
subform flashed, ever so slightly, after I made my combo box 2 choice. But
other than that, nothing seems to be happening. All I see displayed in the
fields is "#Name?" as was dislayed when the form opened. Here's my event
procedure code for combo box 2:

Private Sub cbxCatalogVers_AfterUpdate()
On Error GoTo Err_cbxCatalogVers_AfterUpdate

Forms!frmSubModules!subSubModules.Form![CatalogVers].Requery

Exit_cbxCatalogVers_AfterUpdate:
Exit Sub

Err_cbxCatalogVers_AfterUpdate:
MsgBox Err.Description
Resume Exit_cbxCatalogVers_AfterUpdate

End Sub


If you could help shed some light on why I can't my subform to display the
reocrds I want, and what I have to do to make that happen, I surely ould
appreciate it. And perhaps you might even know why combo box 2 only works once
after opening the form? Any and all help is appreciated.

Thanks in advance,

Tom
 
A

Andi Mayer

you said:
I have a form with a subform. The form has two combo boxes, and the subform is
a continuous form to display the records that the two combo boxes select.

I seem to have the combo boxes working except for:

.......

and what is the recordsource of the subform?

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
A

Andi Mayer

I have a form with a subform. The form has two combo boxes, and the subform is
a continuous form to display the records that the two combo boxes select.

I seem to have the combo boxes working except for:

......................

and the recordsource of the subform?


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
T

Tcs

Record Source of Main form: tblSubModules

Record Source of subForm: doesn't exist

Source Object of subForm: subSubModules
 
A

Andi Mayer

Record Source of Main form: tblSubModules

Record Source of subForm: doesn't exist
and what do you want to see in the subform?


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
T

Tcs

Every record from the one table that meets the criteria of both combo boxes.

Combo Box 1: Apps (MetaSchema)

Combo Box 2: Version of Apps (MetaSchema)

rather than the entire table, as I started out with, before my combo boxes.
 
A

Andi Mayer

Every record from the one table that meets the criteria of both combo boxes.

Combo Box 1: Apps (MetaSchema)

Combo Box 2: Version of Apps (MetaSchema)
if you don't have a recordsource, you can't see anything.

So set the recordsource to the "one" table with a WHERE clause that
reflects the Values of both comboBoxes like:

in the AfterUpdate of the combobox2

Me.SubformControl.Form.recordsource=
"SELECT * FROM one-table
WHERE criteria1=" &me.Combobox2 &" AND criteria20=" &Me.Combobox2

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 

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