Hi,
I have combobox, cboAssetCode (used to select AssetCode) and listbox, lstAssetDetails (to display all info that relevant with the selected AssetCode).
My problem is, all the AssetCode have different info. It means, each AssetCode has their own form. Any idea?
This code is taken from the sample database on the FAQ. This is what i've done..
It works if the AssetCode is the same. What i'm trying to do is to combine all the different AssetCode (using UNION ALL) and when user double click on the listbox, it will goes to the respective form.
Any idea?
Thanx..
I have combobox, cboAssetCode (used to select AssetCode) and listbox, lstAssetDetails (to display all info that relevant with the selected AssetCode).
My problem is, all the AssetCode have different info. It means, each AssetCode has their own form. Any idea?
This code is taken from the sample database on the FAQ. This is what i've done..
Code:
Private Sub lstAssetDetails_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmHardware", , , "[ID] = " &
Me.lstAssetDetails, , acDialog
End Sub
Private Sub cboAssetCode_AfterUpdate()
Dim strSQL As String, strOrder As String, strWhere As
String
Dim qryDef As QueryDef
Dim dbNm As Database
Set dbNm = CurrentDb()
strSQL = "SELECT ID, AssetCode, AssetNo, Desc,
SerialNo FROM tblHardware"
strWhere = "WHERE"
strOrder = "ORDER BY tblHardware.ID;"
If Not IsNull(Me.cboAssetCode) Then
strWhere = strWhere & " (tblHardware.AssetCode)
Like '*" & Me.cboAssetCode & "*' AND"
End If
strWhere = Mid(strWhere, 1, Len(strWhere) - 5)
Me.lstAssetDetails.RowSource = strSQL & " " & strWhere
& "" & strOrder
End Sub
It works if the AssetCode is the same. What i'm trying to do is to combine all the different AssetCode (using UNION ALL) and when user double click on the listbox, it will goes to the respective form.
Any idea?
Thanx..