I have one main form that when you click a button it opens another form with values in a list box. What I want is to click on one of the values and have that value populate a text box in the other form.
I have tried several different methods, and this is what I am currently working with trying to get to work.
In the main form:
Private Sub txtFindInvoice_AfterUpdate()
If IsNull(Me.OpenArgs) = False Then
txtFindInvoice = strSelectedInvoice
End If
End Sub
In the second form:
Private Sub lstInvoices_Click()
DoCmd.OpenForm "SummaryByInvoice1", acNormal, , , , , lstInvoices.Value
Forms!SummaryByInvoice1.Refresh
DoCmd.Close acForm, "frmSearchByMonth"
End Sub
The main form is "SummaryByInvoice1" and the form that opens up is "frmSearchByMonth". The text box is txtFindInvoice, and the list box is lstInvoices.
What it comes down to, I think, is that even when I reference the OpenArgs value I set here in the code for SummaryByInvoice1, the form is not actually being reopened, so the OpenArgs are still being read as blank.
I tried closing SummaryByInvoice1 when frmSearchByMonth is opened, and this solves the problem. That is not a viable option, however, because frmSearchByMonth pulls from a large amount of data and is a little slow to load. Therefore, I can't have a blank screen for a couple seconds. If there was a way to delay the close for a couple seconds, that could work.
Any help is appreciated. Thanks.