downhilljon
Registered User.
- Local time
- Today, 09:38
- Joined
- Jun 14, 2007
- Messages
- 31
Hi there,
My apologies to those whoe have already read this post - I originally tacked it onto an existing thread, but just thought I would repost to try to get a solution.
My situation is that form A and form B can be used to open form C. However, depending on which form is used to reach form C, I need to change the RowSource of a ListBox on form C to one of two queries.
I am having all sorts of trouble. Once the 'open' command is fired from either form A or B, the listbox is immediately looking for parameters for the queries before any code can be used to set the rowsource in either the Open, Load or Activate events.
This is the code from forms A and B which open form C:
This is the code for when form C opens:
I have even tried resetting the rowsource to an empty string on closing form C, but this won't save!!! The rowsource is still set to one of the queries when I open form C again.
Any suggestions are very welcome!
My apologies to those whoe have already read this post - I originally tacked it onto an existing thread, but just thought I would repost to try to get a solution.
My situation is that form A and form B can be used to open form C. However, depending on which form is used to reach form C, I need to change the RowSource of a ListBox on form C to one of two queries.
I am having all sorts of trouble. Once the 'open' command is fired from either form A or B, the listbox is immediately looking for parameters for the queries before any code can be used to set the rowsource in either the Open, Load or Activate events.
This is the code from forms A and B which open form C:
Code:
'Open form
DoCmd.OpenForm "frmOutputs_9_Track_Invoices", , , , , , 2
Code:
'Open form
DoCmd.OpenForm "frmOutputs_9_Track_Invoices", , , , , , 1
This is the code for when form C opens:
Code:
Private Sub Form_Open(Cancel As Integer)
Select Case Me.OpenArgs
Case 1 'frmOutputs_2_Specific_Search_Results' was used
Me.lstResults.RowSource = "qryOutputs_9_Track_Invoices1"
Case 2 'frmInputs_14_Track_Invoice' was used
Me.lstResults.RowSource = "qryOutputs_9_Track_Invoices2"
End Select
End Sub
I have even tried resetting the rowsource to an empty string on closing form C, but this won't save!!! The rowsource is still set to one of the queries when I open form C again.
Code:
Private Sub Form_Close()
Me.lstResults.RowSource = ""
DoCmd.Save acForm, Me.Name
End Sub
Any suggestions are very welcome!