473,385 Members | 1,331 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.

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 5852
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.openargs) 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
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...
6
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...
25
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...
8
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...
15
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...
4
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...
15
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...
2
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...
6
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.