Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound Listbox give null value to unbond Text box

Status
Not open for further replies.

noorani

Programmer
Dec 11, 2002
46
FR
Hi,
I have an unbound Listbox based on a calculated query as row source, i can see the data in my listbox but when i try to get this data to one of my unbound text box field i get null value. here is the example.
List box data:

Customer_ID Balance
1100 -4993,22

now i want to have this Balance value in my text box field. for that i'm using control source of my text box, and it's look like this.

=[listbox1]![column](1)

and it's always null.

Please guide me where i'm wrong.

Thanks in advance.
 
You need a dot, not a !, because column is a property of the listbox:
=[listbox1][red].[/red][column](1)
 
Thx Remou for your reply, you are right, but i still didn't get the value. as i understand untill the list box is not selected or not get focused, i'll not get the value in my text box field automaticaly, i'm still looking for the solution.
 
If your ListBox has only one row:
=Me!listbox1.Column(1, 0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I wonder why? I have tested this with a two column listbox, based on a query. As I select each row in the listbox, the test textbox is populated with the correct value. Perhaps you could post the SQL for the Row Source? Or would it be worth trying a new form, with just a listbox and a textbox to see if the problem still occurs?
 
thx PHV
=Me!listbox1.Column(1, 0) ' didn't work out.
at this point i like to be in details. actually i wanted to get the value from the listbox using VB Code but i never succeed so i decided to drop this idea and get the value out from the listbox and store it to text box and then use it for further process. here is the part of my code which i wanted to use

===== code starts =======
'Check the balance to allow managers to make new reservation only for the available limit amount for the client.

Dim ballmthol As double
Dim balcurrhol As double
Dim balcheckhol As double
ballmthol = 0 ,Balance limit
balcurrhol = 0 , Current Balance
balcheckhol = 0 , Balance limit check

'Store Balance limit
ballmthol = CS!ballimit

**A**

'here i have error i always have null value

balcurrhol = Me.Balancelist.Column(1)

'store the available amount for reservation.

balcheckhol = ballmthol - balcurrhol

' check the current invoice for validation
If Me.total > balcheckhol And Me.spcheck = False Then
........
and so on. the only problem i have is on tag **A**

i believe that my proble is now much more clear.
 
I suggested something like this:
balcurrhol = Me.Balancelist.Column(1, 0)

BTW, what is the SQL code of Balancelist.RowSource ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thx PHV , now it's work out, i use it in my code and every thing is perfect, thank you very much PVH, and Remou.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top