By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,045 Members | 2,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,045 IT Pros & Developers. It's quick & easy.

Substituting a variable in a form control

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.