change datasheet source in subform to query (being prompted for parameter value)

M

Mike

Hi,

I have a form with an unbound combobox (row source type table/query, row
source set to a table), then a subform with a datasheet. Selection in
combobox deturmines records displayed in the datasheet, this works fine.

On the main/parent form I have a button, on clicking this I want to replace
the contents of the datasheet with the results of a query. The datasheet
has 6 fields (one of which may be hidden depending on the combobox
selection), the query returns one (or more) fields.

I am trying to use

Me.Subform1.Form.RecordSource = "myQuery"

to display the contents of the query in the datasheet, but I keep getting
prompted to "Enter Parameter Value" (the field being referred to is the
rowsource for the combobox on the main form).

When the query is run outside of the combobox no prompt for parameter value
occurs.

When I run the query from the form I will also be disabling the combobox, so
it doesn't matter (for my purposes what value is in the combo.

What am I doing wrong ? (am a newbie to access)

thanks for any help.

Mike
 

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