473,563 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open form with a different recordsource

RLN

RE: Access 2003

I have a SQL variable (strSQL1 dimmed as String) that gets built using
Select Case logic. The first half of strSQL1 is etched in stone no
matter what.
The 2nd half of strSQL1 (the condition) is built depending on which
option button is chosen:
For option 1, I add "Condition X" to the end of strSQL1.
For option 2, I add "Condition Y" to the end of strSQL1...etc.

When the Select Case logic is completed strSQL1 is built and I then need
to launch a form in Datasheet mode using strSQL1 as my data source.

Can this be done?
*** Sent via Developersdex http://www.developersdex.com ***
Jul 3 '08 #1
4 5869
RLN wrote:
RE: Access 2003

I have a SQL variable (strSQL1 dimmed as String) that gets built using
Select Case logic. The first half of strSQL1 is etched in stone no
matter what.
The 2nd half of strSQL1 (the condition) is built depending on which
option button is chosen:
For option 1, I add "Condition X" to the end of strSQL1.
For option 2, I add "Condition Y" to the end of strSQL1...etc.

When the Select Case logic is completed strSQL1 is built and I then need
to launch a form in Datasheet mode using strSQL1 as my data source.

Can this be done?
*** Sent via Developersdex http://www.developersdex.com ***
I suppose you could launch and change the source.
DoCmd.OpenForm "FormName", , , , , , strSQL1

Now in the OnOpen even you could do
If Not IsNull(me.opena rgs) then Me.Recordsource = Me.OpenArgs

But I don't see the necessity because the table info isn't
changing...just the filter. Let's say you simply make strSQL1 the
conditional then pass the filter. Ex:
strSQL1 = "customerid = 123".
DoCmd.OpenForm "FormName", , , strSQL1
and this will open it to filtered records where customerid = 123

Once in a form, you could do things like this
Me.Filter = "CustomerID = 123"
Me.FilterOn = True

Powerful
http://www.youtube.com/watch?v=YhrLBrDzj5Q
Jul 3 '08 #2
RLN


ok...let me add one bit of mere complexity to this if I may.

The form that calls this query is chock full of text boxes and I cannot
afford realestate on the form to put yet another generic text box for
parameter input.
Is there a way to pop an input box on the dcmd.openf rom statment so the
user can input data for this query (much like what happens when a query
is run as standalone)?

thnkx.......
*** Sent via Developersdex http://www.developersdex.com ***
Jul 3 '08 #3
RLN wrote:
>
ok...let me add one bit of mere complexity to this if I may.

The form that calls this query is chock full of text boxes and I cannot
afford realestate on the form to put yet another generic text box for
parameter input.
Is there a way to pop an input box on the dcmd.openf rom statment so the
user can input data for this query (much like what happens when a query
is run as standalone)?

thnkx.......
That doesn't make sense. You have 2 checkboxes that determines the SQL
string for creating a filter. The recordsource of your second form
won't change, simply the criteria. Are you saying you have no command
button or use the checkbox for launching the second form? How do you
open the form?

You should be able to open a form and set the filter there if you want.

You can also open the form with the filter passed to it.

The only reason you need to change the recordsource of the second form
is if you are using other tables.

>
*** Sent via Developersdex http://www.developersdex.com ***
Jul 3 '08 #4
RLN
>>You can also open the form with the filter passed to it.
<<

You mean passed in as a parm?
*** Sent via Developersdex http://www.developersdex.com ***
Jul 8 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
4623
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's not obvious how the code works if you don't know the intricacies of the Property Let/Get syntax. Likewise, I dislike (and code to minimize the use...
6
1998
by: John Baker | last post by:
Hi: Does "On Open" code execute before or after related data is loaded? I want to test before the form appears on the screen to see if there is any data in the queryresult, and if there is not then I want to close the form unseen by the end user. Regards John baker
25
10183
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab...
8
10751
by: lauren quantrell | last post by:
When I open an Access form I can have no recordset specified, then in the form's OnOpen event I can do something like: Me.paramaters = "@SomeColumn = 22)" Me.recordsource = "dbo.sproc123" But I can't do this in a report as it will prompt me for the parameters, even though they seem to be defined ahead of the recordsource. I have worked...
15
6463
by: kokostik | last post by:
I did a few searches, but couldn't come up with a clear answer to my question. So here it is: If I am in an open form (MyForm1), is it possible to set the RecordSource of an un-opened form (MyForm2). I want to use the OnClose Event of MyForm1. But I do not want to have the MyForm2 open when this happens. My wish it to have the...
4
3159
by: piscogirl | last post by:
Hi all, Here's my case: I have a form: Event Form and a subform: AttendanceSubForm The user selects a name (from a Person Table) on the subform to register for the event. If the name is not there, they are to click a
15
3921
by: fredindy | last post by:
I'm having trouble figuring out what I need to do here. Basically, I want to pull data from several different tables and send them to a form using open args. However, the form that is being fed need to have certain columns of data concatenated. Here is the code I have so far. I'm sure it's not right because it doesn't work right. Private...
2
3474
by: David Haskins | last post by:
I have a fairly complex interface screen (form) that is comprised of several subforms that perform different, but related activities. I am designing a search/filter form that should be able to change the data displayed in one or more of the other forms, but I cannot find the way to change the Recordsource property of the second form from the...
6
6410
by: Steve | last post by:
Is there a way to programatically open a form named "MyForm" in another Access database in design view and get various properties of the form? Thanks! Steve
0
7579
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...
0
8101
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...
1
7631
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7943
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6238
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...
1
5479
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...
0
5204
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...
1
2077
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.