By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,833 Members | 2,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,833 IT Pros & Developers. It's quick & easy.

Passing parameters to a sub form's recordsource

P: n/a
I am trying to write a simple form that allows a user to search
through an address table. The main form has the text boxes (to be used
as where parameters) and when clicking the search button will create
an sql string that is to be used as the recordsource for the subform.
The subform is requeried and all is apples.

However I can't work out how to do this when the recordsource for the
subform has to be a pass through query. I have a static pass through
query without parametrs as the recordsource that works fine but can't
figure out how to add the parameters. Has anyone done this before?
thanks
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Perhaps you could do something like this:

1) Keep the subform invisible until the 'search' button (or however
you do it) is clicked.

2) Set the subform's RS to be any ol' passthrough query, as long as
the connection is set up properly. You need not set params in the
queries properties (I forget if you even can with a passthrough,
actually)

3) When the 'search' button is clicked, open the querydef of the PTQ
in code, setting the .SQL property, something like this:

set qdf=db.QueryDefs("qMyPassThroughQuery")
qdf.SQL = "Exec procMyProcWithParams '" & Me.txtAddress1 & "', '" &
Me.txtCity & "', '" & ETC
me.MySubForm.requery

Catch me drift, mate?

hth,
brett

da***********@agric.nsw.gov.au (bentond) wrote in message news:<2b**************************@posting.google. com>...
I am trying to write a simple form that allows a user to search
through an address table. The main form has the text boxes (to be used
as where parameters) and when clicking the search button will create
an sql string that is to be used as the recordsource for the subform.
The subform is requeried and all is apples.

However I can't work out how to do this when the recordsource for the
subform has to be a pass through query. I have a static pass through
query without parametrs as the recordsource that works fine but can't
figure out how to add the parameters. Has anyone done this before?
thanks

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.