Hi,
I have two listboxes, populated as follows
Sub Form_Load()
Me.trade1.RowSource = "SELECT COUNT(Qry_Summary_GetAllDeals.Type) FROM Qry_Summary_GetAllDeals WHERE (((Qry_Summary_GetAllDeals.Type)=""trade""));"
Me.trade4.RowSource = "SELECT COUNT(Qry_Summary_GetAllDeals.Type) FROM Qry_Summary_GetAllDeals WHERE (((Qry_Summary_GetAllDeals.Type)=""trade"") AND ((Qry_Summary_GetAllDeals.Finance)>0));"
I then want to use the values of the two listboxes in a calculation
Dim trade5value As Integer
trade5value = (trade4.Value / trade1.Value) * 100
Me.trade5.Value = trade5value
This returns an error "invalid use of null",
Is this due to the listbox having nothing selected? If so how can I select its value in code?
Thanks
I have two listboxes, populated as follows
Sub Form_Load()
Me.trade1.RowSource = "SELECT COUNT(Qry_Summary_GetAllDeals.Type) FROM Qry_Summary_GetAllDeals WHERE (((Qry_Summary_GetAllDeals.Type)=""trade""));"
Me.trade4.RowSource = "SELECT COUNT(Qry_Summary_GetAllDeals.Type) FROM Qry_Summary_GetAllDeals WHERE (((Qry_Summary_GetAllDeals.Type)=""trade"") AND ((Qry_Summary_GetAllDeals.Finance)>0));"
I then want to use the values of the two listboxes in a calculation
Dim trade5value As Integer
trade5value = (trade4.Value / trade1.Value) * 100
Me.trade5.Value = trade5value
This returns an error "invalid use of null",
Is this due to the listbox having nothing selected? If so how can I select its value in code?
Thanks