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

Set variable from value in a table

P: n/a
Hello,

I created a program in which I use modules and classmodules for setting my
variables. For example when I need to set the customerID in a variable I use
something like: Object.Variables.Customers.CusomerID = ....
This works great and is similar in structure as for example the Docmd. or
me. structure.

Now I created a search form which can be opened from many forms, it consist
of only a listbox. The listbox is filled at startup. All necesery data I
keep in a table (row source, column withs etc). When I doubleclick on the
listitem I want a variable to be set. Instead of creating a long If..then.
structure, I want to keep the variables which needs to be set in my table.
So now I have a value in a table, which represents my variable. Is there a
way I can set the variable this way.

For example: I have a record in the table for a cusomter search. When I
doubleclick in the listbox I want the value in my table (which represents
the variable) to be set. So in the table is
"Object.Variables.Customers.CusomerID" (as a value) and the listbox gives a
customerID which needs to be matched to the
Object.Variables.Customers.CusomerID variable.

IS this possible???

Thanx,

Remco
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If I understand you correctly, I think many of us merely human Access
programmers would do this:

Assuming the data for your listbox is in a table named tblCustomer, and that
it has (at least) two fields:
CustomerID
CustomerName

Set the RowSource of your listbox like this:
SELECT CustomerID,CustomerName FROM tblCustomer

Set the listbox's BoundColumn property to 1, its ColumnCount property to 2,
and its ColumnWidths to 0;1.
Now the listbox should display all of your CustomerNames in a list 1" wide.
(If you want it a different width, change the second value in ColumnWidths.)
When you click on an item in the listbox, the listbox's Value property will
hold the value of the corresponding CustomerID, and be used in coding as
MyListbox.Value. (Use the name of your listbox instead of MyListbox, of
course.)

HTH
- Turtle

"Remco Groot Beumer" <in**@rgbplus.nl> wrote in message
news:c0**********@news3.tilbu1.nb.home.nl...
Hello,

I created a program in which I use modules and classmodules for setting my
variables. For example when I need to set the customerID in a variable I use something like: Object.Variables.Customers.CusomerID = ....
This works great and is similar in structure as for example the Docmd. or
me. structure.

Now I created a search form which can be opened from many forms, it consist of only a listbox. The listbox is filled at startup. All necesery data I
keep in a table (row source, column withs etc). When I doubleclick on the
listitem I want a variable to be set. Instead of creating a long If..then.
structure, I want to keep the variables which needs to be set in my table.
So now I have a value in a table, which represents my variable. Is there a
way I can set the variable this way.

For example: I have a record in the table for a cusomter search. When I
doubleclick in the listbox I want the value in my table (which represents
the variable) to be set. So in the table is
"Object.Variables.Customers.CusomerID" (as a value) and the listbox gives a customerID which needs to be matched to the
Object.Variables.Customers.CusomerID variable.

IS this possible???

Thanx,

Remco

Nov 12 '05 #2

P: n/a
Remco Groot Beumer wrote:
Instead of creating a long If..then.
structure, I want to keep the variables which needs to be set in my table.
So now I have a value in a table, which represents my variable. Is there a
way I can set the variable this way.


Maybe I don't understand the question correctly; but does the article
'public variables' on my site provide any help?

Especially the Click portion of the question is unclear to me. It may
help if you mail me in Dutch?
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.