Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    228
    Happy to have helped.

  2. #17
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    NEEd YOUR help again i made another search menu and my code doesnt go to that record.
    Code:
    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;
    and my visualbasic is
    Code:
    Private Sub List10_DblClick(Cancel As Integer)
     
     
    DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber ='" & Me.List10 & "'"
    End Sub
    can you help

  3. #18
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    What is the data type of AssetNumber?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    its an text i used
    Code:
    DoCmd.OpenForm "Hardware Asset Update Form", acNormal, , "AssetNumber ='" & Me.List10 & "'"

  5. #20
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Is the listbox multiselect? Set a breakpoint or add

    Debug.Print Me.List10

    and verify what the listbox is returning.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    Code:
    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
    add this code and nothing happen it took me to an blank Hardware Asset Update Form I believe this is and mutiselect field

  7. #22
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    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.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    Two things this code give me the no output
    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
    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.

  9. #24
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    Its in access 10 is that a problem?

  11. #26
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57

    Here it is

    I hide most of the tables Im working with search form that uses an search query
    Asset Database 070520121.zip

  12. #27
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    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.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #28
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    Wowww thank you it worked

  14. #29
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. form search
    By ashwin09 in forum Code Repository
    Replies: 2
    Last Post: 10-13-2013, 08:47 AM
  2. Search Form Help
    By carguy37757 in forum Forms
    Replies: 4
    Last Post: 09-16-2011, 11:23 AM
  3. Search Form
    By roger556 in forum Forms
    Replies: 5
    Last Post: 07-16-2011, 02:11 PM
  4. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  5. Search box on a form.
    By annaisakiwi in forum Forms
    Replies: 3
    Last Post: 01-02-2011, 08:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums