473,761 Members | 10,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5097
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.QueryDef s("qMyPassThrou ghQuery")
qdf.SQL = "Exec procMyProcWithP arams '" & Me.txtAddress1 & "', '" &
Me.txtCity & "', '" & ETC
me.MySubForm.re query

Catch me drift, mate?

hth,
brett

da***********@a gric.nsw.gov.au (bentond) wrote in message news:<2b******* *************** ****@posting.go ogle.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
6421
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 opened. The reports record source is a query. The query uses the value from the form text box to restrict the query. Table name = EggsTable one of the columns in the table is named: EggColor Form name = EggColorForm Form text box name = ColorTextBox
8
9871
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 a temp table. The procedure takes two parameters to specify the criteria on selecting the table information for inclusion in the result set, builds the temp table,
4
3442
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
3744
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 take input parameters from form X. When I open A from form Y, I want it to take input parameters from form
2
5278
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 clicks once they have selected the desired record. The button calls a report which uses a stored procedure as its record source. The SP has 2 input parameters, one of which is a datetime data type. In the input parameters data field of the...
2
4376
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 parameters such as: ! ! So I have code in the On Open event of frmSwapsLive as follows: strLive = "frmSwapsLive" strTest = "frmSwaps" frmName = frm.Name
5
5306
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 user prompted for them). Based on a Microsoft page (http://support.microsoft.com/kb/287437), I tried the following approach: Private Sub Report_Open(Cancel As Integer) Dim sql As String
1
3097
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 VBA is to use DoCmd.OpenForm. However, is there any way I can pass the data source as well? I've tried using the OpenArgs parameter, which partially works, but I have code on form.current which does a recordsetclone. When it gets to this I get a...
7
5519
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 I can't figure out what I'm doing wrong. I have a form that uses a query as its recordsource; I'll call the query qryParent. qryParent is based on 2 nested queries; which is to say qryParent selects from qryChild2 and qryChild2 selects from...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.