[AccessD] How do I refer to controls in an ADP

artful at rogers.com artful at rogers.com
Tue Feb 13 05:50:24 CST 2007


Hi Darren,

There are numerous ways to do what you want. I assume that you already know how to create a static function. (If not, then search the archives; I have written on this several times.)

Assuming that you have a static function that can get/set the value of interest, then you have several options:

1. create a stored procedure that accepts a value and supply its name as the rowsource of your second control. Then pass the static function's return value to it, like this:

MyControl.RowSource = exec MySproc MyStatic()

2. Create a UDF that does the same thing, in which case the rowSource would be = MyUDF(MyStatic()).

In either case, fire the second control immediately after obtaining the value for the first control. You can do this in several ways, too. Typically, I do it be redefining the RowSource, but there are other ways too. I think they are all about equivalent, so it's just a matter of taste how you do it.

If you need more precise instructions, hang on a bit and I will supply a simple ADP that illustrates how to do this. (I haven't got SQL 2000 installed at the moment, and A2K3 doesn't support all the cool extensions in SQL 2005, but I'm installing it now so I can whip up the example.)

 
Arthur Fuller
Technical Writer, Data Modeler, SQL Sensei
Artful Databases Organization
www.artfulsoftware.com




----- Original Message ----
From: Darren DICK <darrend at nimble.com.au>
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Sent: Tuesday, February 13, 2007 6:26:01 AM
Subject: Re: [AccessD] How do I refer to controls in an ADP


Thanks Arthur

I am just 'testing' at the moment - Never done an ADP

Basically I have 2 combos. The first has an item selected then the 'query I am
speaking about will be come the recordset for the second one - based on what the
user selected in the first

Simple in VBA

Can this be done - I'd just like to know how it is done?

If you have a better or more elegant way that allows for re-use I'd love to see
it too please 

How do I bind any recordset from a Static Function to anything on an ADP -
Combo, Page etc

Anything

Many thanks

Darren
------------------
T: 0424 696 433

-----Original Message-----
From: artful at rogers.com [mailto:artful at rogers.com] 
Sent: Tuesday, 13 February 2007 7:46 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How do I refer to controls in an ADP

As for me, I don't like queries that refer specifically to a given form's
controls, since they cannot be run without that form being open. I like to use
static functions for this. JWC prefers to use a class. Either way, you gain the
freedom from form-binding and thus can use the query in numerous contexts,
without depending on the form.

Arthur 

----- Original Message ----
From: Darren DICK <darrend at nimble.com.au>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Sent: Monday, February 12, 2007 11:46:36 PM
Subject: [AccessD] How do I refer to controls in an ADP


Hi all

Normally in the Criteria for a query I would type something like
Forms!frmCoolForm!txtSomeControl 

What would I type in the criteria of a query to refer to an ADP?
Pages!pgCoolPage!txtSomeControl won't work

Any suggestions?

Thanks
DD
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list