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

declaration

P: n/a
I would like to pass full name (path) of a list box (ListBoxName) to a
function, so that I can reference it inside the function as
ListBoxFullName.Column(0, varItem).
How should I declare ListBoxFullName ? As object, name, string or something
else?

Zlatko

Jan 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Pass the list box instead of it's name.
You can then get at any of its properties or methods.

Example:
Function DoSomething(lst As Listbox)
Debug.Print "The list box is called " & lst.Name
End Function

Then call it like this:
Call DoSomething(Me.[NameOfYourListBoxHere])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zlatko Matif" <zl***********@sb.t-com.hr> wrote in message
news:dq**********@ss405.t-com.hr...
I would like to pass full name (path) of a list box (ListBoxName) to a
function, so that I can reference it inside the function as
ListBoxFullName.Column(0, varItem).
How should I declare ListBoxFullName ? As object, name, string or
something else?

Jan 18 '06 #2

P: n/a
Per Allen Browne:
Then call it like this:
Call DoSomething(Me.[NameOfYourListBoxHere])


Any reason for using "Call..." instead of

DoSomething me.lstWhatever

?
--
PeteCresswell
Jan 18 '06 #3

P: n/a
Call is optional.

I prefer it because because:
a) It works in all versions, regardless of whether DoSomething is a Sub or
Function.
b) It standardizes the way arguments are passed (bracketing.)
c) It distinguishes a user-defined procedure from a built-in keyword.
which to me seems more consistent and readable (so maintainable.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"(PeteCresswell)" <x@y.Invalid> wrote in message
news:ob********************************@4ax.com...
Per Allen Browne:
Then call it like this:
Call DoSomething(Me.[NameOfYourListBoxHere])


Any reason for using "Call..." instead of

DoSomething me.lstWhatever

?
--
PeteCresswell

Jan 18 '06 #4

P: n/a
OK. it should be declared as Control.

"Zlatko Matić" <zl***********@sb.t-com.hr> je napisao u poruci interesnoj
grupi:dq**********@ss405.t-com.hr...
I would like to pass full name (path) of a list box (ListBoxName) to a
function, so that I can reference it inside the function as
ListBoxFullName.Column(0, varItem).
How should I declare ListBoxFullName ? As object, name, string or
something else?

Zlatko

Jan 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.