Multiplying value

mfuada

Registered User.
Local time
Tomorrow, 03:46
Joined
Feb 4, 2009
Messages
63
Hi guys i need some help...
Right now i want to multiplying values from a textbox and a listbox into a new textbox,the condition are:
1. the listbox has a row source from a query,so the data that displayed in
that listbox is based on a result of a query that sum value from a table.
2. user directly input values into the result textbox

I have tried with directly multiplying them from the new textbox Control source but failed, and i also try adding a button with event on click goes like this :
Private Sub Command30_Click()
result_txt.Text = input_txt.Text * ListBox_query.Value
End Sub

and it also failed can anybody give a help?
 
Here an extract from the Access help:

While the control has the focus, the Text property contains the text data currently in the control; the Value property contains the last saved data for the control. When you move the focus to another control, the control's data is updated, and the Value property is set to this new value. The Text property setting is then unavailable until the control gets the focus again.

You might want to try the Value property instead of the Text property. It could also fail because you are multiplying strings (VB/Access is very forgiving in this regard though). You can force conversion with CLng like

result_txt.Value = CLng(input_txt.Value) ...

HTH
Thomas
 
Okey i've changed to value property and it works... Thx a lot!
 
You are welcome. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom