Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Access

Does anyone have an actual tested Add (All) to combo functio

 
Jump to:  
 
Chris O'C via AccessMonst
PostPosted: Wed Sep 03, 2008 9:55 pm    Post subject: Re: Does anyone have an actual tested Add (All) to combo fun
       
Did you try looking up RowSourceType in Access help? I did and this is what
I found.

"Note You can also set the RowSourceType property with a user-defined
function. The function name is entered without a preceding equal sign (=) and
without the trailing pair of parentheses. You must provide specific function
code arguments to tell Microsoft Access how to fill the control."

So there isn't supposed to be a list of every public function in your db in
the drop down for you to click on. You manually type the function name,
AddAllToList, in the Row Source Type property for the list box.

Chris
Microsoft MVP


Ron's Hotmail wrote:
Quote:
I am trying to follow the example at
LINK

The instructions for making use of the function are to set the RowSourceType
property to the function name (AddAllToList). The drop down choices for
RowSourceType do not include a function name.

I am a 66 year old 40 year computer veteran and I do not understand how an
example like this can get on a microsoft site.

Can someone please point me to a correct resource?

--
Message posted via AccessMonster.com
LINK
 

 
Ron's Hotmail
PostPosted: Thu Sep 04, 2008 1:40 pm    Post subject: Re: Does anyone have an actual tested Add (All) to combo fun
       
Thanks for the response Chris.

I did try HELP and just tried it again but I get 100 replies and I can't see
anything useful.

If I do as you say and put in the function name I get an error that says it
might be invalid and press help fo Row Source Type help but I only get the
help Browse section.

Looking at the code more closely reveals that the 2nd parameter is only
referenced in a comment. This is suspicious. I can guess that the 1st parm
is the name of the control but this seems strange since the code is executed
as part of the control. The code to do with lngRow, lngCol and intCode
looks weird to me in that they appear to need different values over time to
work. Since the instructions do not even mention providing args to the
function I am completely confused.

Since this is an article from the msdn site I would expect something better
than this seemingly very incomplete example.

I know you guys get a lot of questions etc from folks that don't use the
help and other resources but I have checked and the example is flawed.

Can you point me to a proper example or to someone/somewhere that can help
me?

Thanks again,
Ron


"Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
news:89a9ab87dfce1@uwe...
Quote:
Did you try looking up RowSourceType in Access help? I did and this is
what
I found.

"Note You can also set the RowSourceType property with a user-defined
function. The function name is entered without a preceding equal sign (=)
and
without the trailing pair of parentheses. You must provide specific
function
code arguments to tell Microsoft Access how to fill the control."

So there isn't supposed to be a list of every public function in your db
in
the drop down for you to click on. You manually type the function name,
AddAllToList, in the Row Source Type property for the list box.

Chris
Microsoft MVP


Ron's Hotmail wrote:
I am trying to follow the example at
LINK

The instructions for making use of the function are to set the
RowSourceType
property to the function name (AddAllToList). The drop down choices for
RowSourceType do not include a function name.

I am a 66 year old 40 year computer veteran and I do not understand how an
example like this can get on a microsoft site.

Can someone please point me to a correct resource?

--
Message posted via AccessMonster.com
LINK
 

 
Chris O'C via AccessMonst
PostPosted: Thu Sep 04, 2008 9:33 pm    Post subject: Re: Does anyone have an actual tested Add (All) to combo fun
       
Are you sure that error message isn't defined in your app? I've never seen
Access give an error message about a function that *might* be invalid. It's
either valid or it's not. No gray area here.

The code works in the versions of Access I've tested it in. The msdn article
author took the code nearly verbatim from Microsoft's kb article (
LINK) which is for Access 2000 so it's
Microsoft's recommended method of filling a combo box, and it's been working
for other Access developers for years.

The 1st parameter is a combobox or listbox control object, not the name of
the object which would be a string data type. It's not strange because the
function uses properties of the control like rowsource and tag, and it's a
callback function for the control (more on that later).

The 2nd parameter isn't needed (and neither the msdn article author or kb
article author knew that) but it was copied from the original and assumed
correct. As I recall the original code example for filling a combo box was
in Access 97 help, and it had that unnecessary ID too.

You don't provide arguments to the function when calling it because it's a
callback function. The argument variables are integrated with the control
(behind the scenes) and incremented/updated as needed by the control as it
fills the grid column by column and row by row with values from the recordset.


I think I've got a simpler example of adding all to a list box. I'll post it
in a few minutes.

Chris
Microsoft MVP


Ron's Hotmail wrote:

Quote:
If I do as you say and put in the function name I get an error that says it
might be invalid and press help fo Row Source Type help but I only get the
help Browse section.

Looking at the code more closely reveals that the 2nd parameter is only
referenced in a comment. This is suspicious. I can guess that the 1st parm
is the name of the control but this seems strange since the code is executed
as part of the control. The code to do with lngRow, lngCol and intCode
looks weird to me in that they appear to need different values over time to
work. Since the instructions do not even mention providing args to the
function I am completely confused.

Since this is an article from the msdn site I would expect something better
than this seemingly very incomplete example.

I know you guys get a lot of questions etc from folks that don't use the
help and other resources but I have checked and the example is flawed.

Can you point me to a proper example or to someone/somewhere that can help
me?

--
Message posted via LINK
 

 
Chris O'C via AccessMonst
PostPosted: Thu Sep 04, 2008 9:56 pm    Post subject: Re: Does anyone have an actual tested Add (All) to combo fun
       
How to add "(ALL)" to the rows in a listbox:

1 - create a new query that has the columns and tables you need for the list
box. Example:

SELECT productID, productname
FROM products
ORDER BY productname

2 - to add (All) to the productname column, modify the query to use a union.
Make sure there's a space before (ALL) in the string so it sorts as the first
row. Example:

SELECT productID, productname
FROM products
UNION SELECT "0" AS productID, " (ALL)" AS productname
FROM products
ORDER BY productname

3 - name the query qryproductsforlistbox.

4 - create a list box on the form and manually type the values for these
properties:

column count: 2
column width: 0";1"
bound column: 1

5 - select these properties from the property drop downs:

row source type: Table/Query
row source: qryproductsforlistbox

That should do it.


Chris
Microsoft MVP


Chris O'C wrote:

Quote:
I think I've got a simpler example of adding all to a list box.

--
Message posted via LINK
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

zakłady bukmacherskie meble kuchenne słupsk wierszyki urodzinowe endermologie Wrocław szybkie kredyty gotówkowe