473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Passing parameters to a sub form's recordsource

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
1 5058
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: rickcheney | last post by:
I just changed my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was clicked a Report was...
8
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing...
4
by: Weaver | last post by:
Supposing I wanted to do something like this: Set rsB = db.OpenRecordset("qryStuff") only qryStuff required parameters? How do I pass the parameter values to the query? Thanks.
5
by: isaacrajan | last post by:
Hello, I have a form A in my ADP project. The record source of A has input parameters. I need to open form A from three different forms X, Y and Z. When I open A from form X, I want it to...
2
by: Bob | last post by:
I'm new to Access projects and SQL server and am not a veteran VB programmer. There's a cry for help! I'm attempting to print the current form on screen by using a command button which the user...
2
by: Bill R via AccessMonster.com | last post by:
I'm trying to use the same subforms for two different mainforms. The first main form is "frmSwaps" and the second main form is named "frmSwapsLive". The recordsources for the subforms have...
5
by: dana1 | last post by:
Hello Experts! Does anyone know if there is a way to set the values of query parameters from VBA for a report's recordsource? (i.e., I want to set the values of the parameters and NOT have the...
1
by: Bobby | last post by:
Hi I have a form which I need to call from several different parts of my application. Depending on where it is called from, the Data source will change. The only way I know of to open a form from...
7
by: Kelii | last post by:
Well, I've been searching around the groups for an answer to this one, and none of the suggestions seems to be working for me. I'm almost positive that this is a simple fix, but for the life of me...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.