Hi Bob
That's a very interesting technique. I have never before heard of anyone
using a listbox purely to execute a SQL statement returning a single value.
However, I can't see how you are getting a result displayed in a third
listbox. If you set the RowSource of a listbox to an expression such as
=[lst2]/[lst1]
you will get an error saying that the record source does not exist.
Are you sure your third control is not a *textbox* and its *ControlSource*
(not RowSource) is the expression you give?
In any case, as I said yesterday, you can refer to the first (in this case
the only) value in a listbox using the ItemData property:
lst1 = lst1.ItemData(0)
will set the value of the listbox to the value of the first item, thereby
effectively selecting the first item.
You can also use the ItemData property as part of a ControlSource
expression. For example, you could have a textbox txt1 with ControlSource:
=[lst1].ItemData(0)
This will always display the first value in lst1, whether or not it is
selected.
Now, if you do the same for txt2: =[lst2].Itemdata(0)
Then you can have a third textbox calculating the quotient:
txt3: =[txt2]/[txt1]
Then make lst1 and lst2 invisible, since they are only being used to execute
the SQL.
I hope I've understood you a little better now :-)

Signature
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
> Graham,
> I am using the list box to run the sql statement and also to do the
[quoted text clipped - 53 lines]
>> > Thanks in Advance,
>> > Bob W.
cox - 20 Apr 2005 13:00 GMT
Graham,
Your solution worked for me!!!
Thank you very much for your time,
Bob W.
> Hi Bob
>
[quoted text clipped - 87 lines]
> >> > Thanks in Advance,
> >> > Bob W.