Results 1 to 11 of 11
  1. #1
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10

    Search Box in Tabbed Sheet not working

    I have a simple text box in a 'Tabbed Form' that I would like to use to search on a single field and show all the data from the related record. The code is assigned to the 'AfterUpdate Event'
    If I add the search box to the original form it works perfectly, however when I operate the search in the tabbed form it cant find any matches.
    Is there something I need to do when working with tabbed froms ?




    Code:
    Private Sub Text85_AfterUpdate()
    If (Text85 & vbNullString) = vbNullString Then Exit Sub
        Dim rs As DAO.Recordset
        Set rs = Me.RecordsetClone
        rs.FindFirst "[ID]=" & Text85
        If rs.NoMatch Then
            MsgBox "Sorry, no such record '" & Text85 & "' was found.", _
                   vbOKOnly + vbInformation
        Else
            Me.Recordset.Bookmark = rs.Bookmark
        End If
        rs.Close
        Text85 = Null
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What do you mean by 'tabbed form' - a tab control? Is this a form/subform arrangement?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Yes, that's correct. I have a number of Tab Controls which hold forms from the database. This particular one is a form/subform and the text box is in the Main form, thanks.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The textbox is on main form and you want to search the main form records?

    The subforms are synchronized with main form through Master/Child links properties?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Yes, absolutely correct on both points.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Try:

    Me.Bookmark = rs.Bookmark

    It isn't really necessary to set a recordset object.
    Code:
    Private Sub Text85_AfterUpdate()
    If (Text85 & vbNullString) = vbNullString Then Exit Sub
        With Me.RecordsetClone
        .FindFirst "[ID]=" & Text85
        If .NoMatch Then
            MsgBox "Sorry, no such record '" & Text85 & "' was found.", _
                   vbOKOnly + vbInformation
        Else
            Me.Bookmark = .Bookmark
        End If
        End With
        Text85 = Null
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Thanks June7 for your assistance.
    I have tried your suggestion but still get the same result, which was the message box saying no such record found !!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Is ID a number field?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Yes, ID is a number field. Providing a copy of the db will take some effort to desensitize, can I provide a more detailed description of the form ?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    If you want, will try to understand.

    I don't see anything else wrong with the code. The method works for me.

    Text85 is UNBOUND?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Greycom4 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    10
    June7, I created a completely new set of tab controls and the search function worked perfectly. In my original tab control the first tab had some objects (buttons) that were setup to run code such as importing data. I think this is where the problem was coming from. Are you aware if it is possibe to have your first tab dedicated to running code and macros from buttons and then the remaining tabs to showing forms ?
    I would be interested in you input. Anyhow, thanks for your assistance and very prompt respone. Regards Greycom4

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 26
    Last Post: 01-08-2013, 04:55 PM
  2. Search box not working
    By banker in forum Forms
    Replies: 2
    Last Post: 08-16-2012, 07:59 PM
  3. Combo Box search not working
    By Lowell in forum Forms
    Replies: 1
    Last Post: 06-02-2012, 12:53 AM
  4. Search Button in a Form not Working
    By spideynok in forum Forms
    Replies: 30
    Last Post: 03-29-2012, 01:10 AM
  5. Search field is not working correctly
    By jakeao in forum Programming
    Replies: 9
    Last Post: 05-18-2009, 07:47 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