Results 1 to 4 of 4
  1. #1
    TheScribe is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    2

    Need help in trouble shooting a "search" button

    Hey all, just found this place because I am very frustrated with a Search button.



    I am trying to get my database to search by Last Name. I have a field called Last Name in the table I want to search and so I have typed in the following VB code:

    Private Sub Command50_Click()

    If IsNull(Text48) = False Then
    Me.Recordset.FindFirst "[Last Name]=" & Text48
    Me!Text48 = Null
    If Me.Recordset.NoMatch Then
    MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
    Me!Text48 = Null
    End If
    End If

    End Sub

    Command50 being the Search button and Text48 being the text box.

    Anyone have ideas from this or do I need to provide more info? Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, for a name (any text field) it would need to be:

    "[Last Name]='" & Text48 & "'"

    You might try the combo box wizard, choosing the third option, "Find a record...". That same code can be adapted to your needs.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    TheScribe is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    2
    THANK YOU THANK YOU THANK YOU!!!!!! That worked perfect.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 02-23-2010, 06:32 PM
  2. search for "*" character
    By supernova122 in forum Access
    Replies: 2
    Last Post: 07-06-2009, 06:16 AM
  3. The search for "quote symbols"
    By Dadmail in forum Queries
    Replies: 1
    Last Post: 03-18-2009, 10:52 AM
  4. Create "reset filter" button
    By vanlanjl in forum Access
    Replies: 0
    Last Post: 03-03-2009, 07:36 AM
  5. "Previous Month" button
    By allochthonous in forum Programming
    Replies: 3
    Last Post: 09-10-2006, 12:15 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