I have a dialog, where a user can type in any part of a key, to look up possible projects. The results show up in a list box. Double-click the item in the list box, and a new form opens. This new form is unbound, and is set as a normal form. The reason I set it up like this is that the results I want to show for the user, I want to show in datasheet. I can't have the main form be a datasheet, because then I can't have buttons and other controls on the form. For this reason, I set up the "results" form to be unbound with a subform set to datasheet and the results to appear in there.
Now I am trying to figure out how to get the chosen item in the list box (column(1) passed as a filter to the left(field,6) of a subform field on the form that is being opened.
this is the code I have for the filter dialog:
This is what I have in the form frmMain, which is opened:
The frmAssetMain is opening, but no filter is being applied. Can someone please help?
thanks
misscrf
It is never too late to become what you could have been ~ George Eliot
Now I am trying to figure out how to get the chosen item in the list box (column(1) passed as a filter to the left(field,6) of a subform field on the form that is being opened.
this is the code I have for the filter dialog:
Code:
Private Sub lstBillingKeyResults_DblClick(Cancel As Integer)
On Error GoTo Err_lstBillingKeyResults_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAssetResults"
'stLinkCriteria = "left(Forms!frmAssetResults!frmAssetTrackingSub.Form!AssetTag,6)=" & "'" & [Forms]![frmAssetMain]![lstBillingKeyResults].Column(1) & "'"
DoCmd.OpenForm stDocName
', , , stLinkCriteria
Forms!frmAssetResults.txtAssetArgs = Me.lstBillingKeyResults.Column(1)
DoCmd.Close acForm, "frmAssetMain", acSaveNo
'Forms!Mainform!Subform1.Form.RecordSource
Exit_lstBillingKeyResults_DblClick:
Exit Sub
Err_lstBillingKeyResults_DblClick:
MsgBox Err.Description
Resume Exit_lstBillingKeyResults_DblClick
End Sub
This is what I have in the form frmMain, which is opened:
Code:
Me.txtAssetArgs = [Forms]![frmAssetMain]![lstBillingKeyResults].Column(1)
If Len(Me.txtAssetArgs.Value & vbNullString) = 0 Then
MsgBox "Must have an asset filter to open asset tracking", vbOKOnly, "Must Choose a Matter Filter"
DoCmd.OpenForm "frmAssetMain"
DoCmd.Close acForm, "frmAssetResults"
Else
Me.frmAssetTrackingSub.Form.Filter = "left(Forms!frmAssetResults!frmAssetTrackingSub.Form!AssetTag,6)=" & "'" & Me.txtAssetArgs & "'"
Me.frmAssetTrackingSub.Form.FilterOn = True
End If
End Sub
The frmAssetMain is opening, but no filter is being applied. Can someone please help?
thanks
misscrf
It is never too late to become what you could have been ~ George Eliot