Originally Posted by
Micron
why open a form, set control values, then open the same form again but with a different view??
The combo box in the form opens up with a default value set to "Limit Exposure Report".
The combo box has 2 values - "Limit Exposure Report" and "Trade Exposure Report".
Obviously, I want it to open up with the combo value set to "Trade Exposure Report" hence why I have this line in my code
Code:
Forms![frmCustomReport]![cboMyTables] = "Trade Exposure Report"
.
Then I need to set the row source of the list box (i.e. lstMyFields) in that form to this query I have called "MergedTradeReport" so that it is populated with the values as being the field names in that query "MergedTradeReport" and that's why I have this line in my code
Code:
Forms![frmCustomReport]![lstMyFields].RowSource = "MergedTradeReport"
Anyways, I ran the below code with the call to the function commented out and still crashes:
Code:
Private Sub cmdOutputTrade_Click()
DoCmd.OpenForm "frmCustomReport", acNormal
Forms![frmCustomReport]![cboMyTables] = "Trade Exposure Report"
Forms![frmCustomReport]![lstMyFields].RowSource = "MergedTradeReport"
Forms![frmCustomReport]![lstMyFields].Requery
'SelectItemsInAListBox "Trade_Exposure_Report"
End Sub