Hello all,
I have a form with a text box that I want to use for a keyword search. Entering text in this box opens up a pop-up form that will display a list box of the records returned based on a query using the keyword value. I want the user to be able to double-click on a record in the list box and have it close the pop-up form and take the value from the list box and send it to a combo box in the original form, which has code to filter the form to the selected record:
I try to use the OpenArgs commands, but I can't get the list box value to paste to the combo box on the main form, and I don't want to have to open & close forms anyway.... can someone help me here?
Thanks,
Chris
Code for main form combo box:
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SystemNumber] = '" & Me![cbo123] & "'"
Me.Bookmark = rs.Bookmark
Code for main form keyword search box:
DoCmd.OpenForm "frmKeywordSearch", _
Datamode:=acFormAdd, _
OpenArgs:=Forms!frmMain.txtKeywordSearch
Code for keyword search form:
Private Sub Form_Open(Cancel As Integer)
Me.txtKeywordSearch.Value = Me.OpenArgs
stDocName = "qryKeywordSystems"
DoCmd.Close acForm, "frmMain", acSaveYes
End Sub
Private Sub lstSystem_DblClick(Cancel As Integer)
Me.lstSystem.Value = Me.OpenArgs
stDocName = "frmMain"
DoCmd.OpenForm "frmMain"
Forms!frmMain.cbo123.Value = Me.OpenArgs
End Sub
Private Sub txtKeywordSearch_GotFocus()
Me.[lstSystem].RowSource = "qryKeywordSystems"
End Sub
I have a form with a text box that I want to use for a keyword search. Entering text in this box opens up a pop-up form that will display a list box of the records returned based on a query using the keyword value. I want the user to be able to double-click on a record in the list box and have it close the pop-up form and take the value from the list box and send it to a combo box in the original form, which has code to filter the form to the selected record:
I try to use the OpenArgs commands, but I can't get the list box value to paste to the combo box on the main form, and I don't want to have to open & close forms anyway.... can someone help me here?
Thanks,
Chris
Code for main form combo box:
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SystemNumber] = '" & Me![cbo123] & "'"
Me.Bookmark = rs.Bookmark
Code for main form keyword search box:
DoCmd.OpenForm "frmKeywordSearch", _
Datamode:=acFormAdd, _
OpenArgs:=Forms!frmMain.txtKeywordSearch
Code for keyword search form:
Private Sub Form_Open(Cancel As Integer)
Me.txtKeywordSearch.Value = Me.OpenArgs
stDocName = "qryKeywordSystems"
DoCmd.Close acForm, "frmMain", acSaveYes
End Sub
Private Sub lstSystem_DblClick(Cancel As Integer)
Me.lstSystem.Value = Me.OpenArgs
stDocName = "frmMain"
DoCmd.OpenForm "frmMain"
Forms!frmMain.cbo123.Value = Me.OpenArgs
End Sub
Private Sub txtKeywordSearch_GotFocus()
Me.[lstSystem].RowSource = "qryKeywordSystems"
End Sub