Happy to have helped.
Happy to have helped.
NEEd YOUR help again i made another search menu and my code doesnt go to that record.
and my visualbasic isCode:SELECT [Hardware Asset].[PO Number], [Hardware Asset].AssetNumber, Order.[CER Number], Order.[Date Ordered], Order.[Date Received], [Hardware Asset].Site FROM [Order] INNER JOIN [Hardware Asset] ON Order.[PO Number] = [Hardware Asset].[PO Number] WHERE ((([Hardware Asset].[PO Number])=[forms]![Search Form]![Text2])) OR ((([Hardware Asset].AssetNumber)=[forms]![Search Form]![Text4])) OR (((Order.[Date Received])=[forms]![Search Form]![Text42])) ORDER BY [Hardware Asset].AssetNumber;
can you helpCode:Private Sub List10_DblClick(Cancel As Integer) DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber ='" & Me.List10 & "'" End Sub
What is the data type of AssetNumber?
its an text i used
Code:DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber ='" & Me.List10 & "'"
Is the listbox multiselect? Set a breakpoint or add
Debug.Print Me.List10
and verify what the listbox is returning.
add this code and nothing happen it took me to an blank Hardware Asset Update Form I believe this is and mutiselect fieldCode:Private Sub List10_DblClick(Cancel As Integer) DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber = '" & Me.List10 & "'" Debug.Print "Some data" & Me.List10 End Sub
You would see the result here:
http://www.baldyweb.com/ImmediateWindow.htm
If it's a multiselect listbox:
http://www.baldyweb.com/multiselect.htm
If it's a multi-value field, I don't know. I haven't/won't use it.
Two things this code give me the no output
and the debugger give me an output but no the right one it give me the number i entered i need the asset number linked to the number the debug give me.Code:Private Sub Command45_Click() On Error GoTo Err_Command45_Click Dim strWhere As String Dim ctl As Control Dim varItem As Variant 'make sure a selection has been made If Me.List10.ItemsSelected.Count = 0 Then MsgBox "Must select at least 1 Asset" Exit Sub End If 'add selected values to string Set ctl = Me.List10 For Each varItem In ctl.ItemsSelected strWhere = strWhere & ctl.ItemData(varItem) & "," Next varItem 'trim trailing comma strWhere = Left(strWhere, Len(strWhere) - 1) 'open the report, restricted to the selected items DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber IN(" & strWhere & ")" Exit_Command45_Click: Exit Sub Err_Command45_Click: MsgBox Err.Description Resume Exit_Command45_Click End Sub
Can you post the db here?
Its in access 10 is that a problem?
I hide most of the tables Im working with search form that uses an search query
Asset Database 070520121.zip
The form being opened has Data Entry set to yes, so it won't pull up existing records. The bound column of the listbox isn't the one you want, and your field is text, so:
strWhere = strWhere & "'" & ctl.Column(1, varItem) & "',"
That said, your listbox is NOT multiselect, so this single line will work if you're going to leave it that way:
DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber = '" & Me.List10.Column(1) & "'"
It failed before because of the incorrect column being referred to.
Wowww thank you it worked
Happy to help.