473,388 Members | 1,286 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,388 software developers and data experts.

Substituting a variable in a form control

Using Access 97, with the runtime parameter.

I have a an application that needs a filter by form replacement, because
that is unimplemented in runtime mode.

I call the filter parameters form from several lookup forms.

I set up the lookup forms to call the openform using me.name as the
openargs.

I can detect the openargs and validate that it is not null, get the
user's input, validate, build the proper where clause, and pass it back
to the correct parent form by using a select case openargs.

However, I have about 10 case statements that each contain very similar
code, wioth the target form name hard-coded.

What I have:
select case openargs
case "Form1"
forms!form1!child1.form.filter = sqlWhereClause
forms!form1!child1.form.filteron = true
case "form2"
forms!form2!child1.form.filter = sqlWhereClause
forms!form2!child1.form.filteron = true
....
end select

What I want is to replace these statements with the following construct
containing a variable for the form name.

forms!(openargs)!child1.form.filter = sqlwhereclause
forms!(openargs)!child1.form.filteron = true

which would remove 30 lines of redundant code from the class module.

I can't find a way to make it work, Tried setting the whole statement
into a variable, and using eval(), different bracketing, ampersands and +
signs to concatenate,

Please, somebody, point me in the right direction.

Bob Q
Nov 12 '05 #1
2 2127
rkc

"Bob Quintal" <Rq******@pants.sympatico.ca> wrote in message
news:03******************************@news.teranew s.com...
What I have:
select case openargs
case "Form1"
forms!form1!child1.form.filter = sqlWhereClause
forms!form1!child1.form.filteron = true
case "form2"
forms!form2!child1.form.filter = sqlWhereClause
forms!form2!child1.form.filteron = true
...
end select

What I want is to replace these statements with the following construct
containing a variable for the form name.

forms!(openargs)!child1.form.filter = sqlwhereclause
forms!(openargs)!child1.form.filteron = true


I believe it's a simple as removing the first bang.

forms(openargs)!child1.form.filter = sqlwhereclause
forms(openargs)!child1.form.filteron = true


Nov 12 '05 #2
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in
news:l3*********************@twister.nyroc.rr.com:

"Bob Quintal" <Rq******@pants.sympatico.ca> wrote in message
news:03******************************@news.teranew s.com...
What I have:
select case openargs
case "Form1"
forms!form1!child1.form.filter = sqlWhereClause
forms!form1!child1.form.filteron = true
case "form2"
forms!form2!child1.form.filter = sqlWhereClause
forms!form2!child1.form.filteron = true
...
end select

What I want is to replace these statements with the following
construct containing a variable for the form name.

forms!(openargs)!child1.form.filter = sqlwhereclause
forms!(openargs)!child1.form.filteron = true


I believe it's a simple as removing the first bang.

forms(openargs)!child1.form.filter = sqlwhereclause
forms(openargs)!child1.form.filteron = true

<Homer> Doh! I knew it was something simple. </Homer>

Thanks a million.

Bob Q
Nov 12 '05 #3

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

Similar topics

2
by: TNGgroup | last post by:
Hi, a Simple Question, I have some code at my form, the code in the form is calling a certain module and execute some code, a certain variable is set to strTemp. but when de module is done. I...
12
by: Phil Certain | last post by:
Hi, I'm trying to do something very simple...or at least it should be. I have created a host page (gen.aspx) and a very simple user control (us.ascx). The corresponding code-behind files are...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
5
by: LisaConsult | last post by:
We upgraded a vb project to vb.net and added many enhancements. The old project was not an MDI and used buttons for functions like adding a record (Alt A), deleteing a record etc. This is a data...
20
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If...
10
by: john_aspinall | last post by:
Hi, I got a bit of problem with Access and was wondering if someone could enlighten me. I'm building a database of products of sale, complete with images. Im importing the product data from...
11
by: David Veeneman | last post by:
I need to get a parent's private variable from within a control. Here's what I'm doing: I have a control that I want to be able to detect the presence of a particular (System.ComponentModel)...
4
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4. I notice for form elements that contain spaces, PHP substitutes an underscore for the element name when the form is submitted. For example, if I have this page...
9
by: JohnR | last post by:
I have the name of a control in a string variable and I want to change one of the controls properties. Right now I recursively scan all the controls on the form until I get one whose name matches...
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: 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...
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...
0
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...
0
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,...
0
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...

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.