I had a listbox with 2 columns and i want to send the Dim [Price] into column 2, i've looked on google and have struggled to find a solution. Can anybody please help? (Tis for work)
Cheers
Lee
I had a listbox with 2 columns and i want to send the Dim [Price] into column 2, i've looked on google and have struggled to find a solution. Can anybody please help? (Tis for work)
Cheers
Lee
What's in column 1? You asked about Dim [Price], why don't you store the price in a table so it's accessible whenever you want without worrying about whether it's declared or not?
If you are going to join it on data from a table, you'll probably want a function getPrice() as Price that displays the price in a query, but that price is going to change I assume depending on what is in column 1. Right? So you'll need to getPrice(identifier as [Datatype]) based on the information in column1. Using the identifier, you could then calculate a Price and display that. (This will probably slow down the query...A Lot)
IE
[VBA]
SELECT Table1.Product, getPrice([Table1].[Product]) as Price From Table1
....
Function getPrice(p as String) as Double/Currency
getPrice = [logic for determining the price based on column1 information]
End Function
[/VBA]
I would suggest storing the Price into a table with its associated [Column1] data. Whether you do it in a temp table that just gets deleted later, or a permanent table that gets updated at a certain point in the application, it'll perform better that way and you can ensure the correct data.
HTH
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.
No no, ive got data in the first column thats just text, its the name of the product, column 2 displays the price, this is so i can do the totals easier because i want to add up all of the numbers in column 2 to get a total.
Then wouldn't you want to just sum the data in column 2? I don't understand what the Dim [Price] was about.
SELECT SUM(Column2) From Table1 and bind it to a textbox under your listbox.
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.
Basically a current form pages price value, then shoves it in the list box after a button is clicked
I'll try and build a demo and see if I can post it for you to reference, unless you want to post what you have. Either way, I'll try and demonstrate it better than I can explain it.
Someday I'll understand everything...
Even then...I'll still pretend I'm a beginner.
Thank you