Hi Folks,
I have a listbox listing my products. The listbox rowsource changes depending upon the user's selection of exactly which products to list, and in addition there are two pricing structures, trade and retail. I have this working quite well using If Then Else, but there is surely a more elegant solution using Select Case. The following code always jumps to Case Else, although I know thru debug that each case is evaluated and that the correct rowsource query is found. But the source is not being altered. Can you see what is wrong?
I have missed out further case statements, debug lines and the turning on/off of labels for the sake of brevity.
Naturally I have tried a number of methods to get this working, but think I'm missing something, um, profound?
Thanks for your time.
Best Regards,
Stonward
I have a listbox listing my products. The listbox rowsource changes depending upon the user's selection of exactly which products to list, and in addition there are two pricing structures, trade and retail. I have this working quite well using If Then Else, but there is surely a more elegant solution using Select Case. The following code always jumps to Case Else, although I know thru debug that each case is evaluated and that the correct rowsource query is found. But the source is not being altered. Can you see what is wrong?
Code:
Dim querySource as String
querySource = me.lstProds.RowSource
Select Case querySource
Case "qry_SearchedStockR"
Debug.Print querySource
lstProds.RowSource = "qry_searchedStockT"
Case "qry_AllSearchedR"
lstProds.Rowsource = "qry_AllSearchedT"
Case "qryNotTyreR"
lstProds.RowSource = "qry_NotTyreT"
Case Else
Msgbox "Trade Price Not Available in This View."
End Select
Naturally I have tried a number of methods to get this working, but think I'm missing something, um, profound?
Thanks for your time.
Best Regards,
Stonward
Comment