Results 1 to 10 of 10
  1. #1
    Join Date
    May 2007
    Posts
    74

    Unanswered: Trying to get a "Find First" button

    Access '97 used to have a "Find First" button when performing a database search using the standard Find dialog.

    Sometime between Access '97 and Access 2003, that button was removed by Microsoft.

    My users keep requesting for that functionality (which I don't blame them - it is useful)

    Is there a way to add/extend a "Find First" button onto the Access 2003 default Find dialog?

    Or, is there an easy way to create a toolbar button that performs a "Find First"? I tried creating a macro, but that didn't work. Somehow, I need to find out what is being typed into the "Find What: " field in the dialog.

    Thanks!

    AzJazz
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    If you don't mind going 'manual', you can always make a command button to open up an InputBox for the user to enter his search argument, and you can code the .FindFirst in VBA.

    Sam

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you're using recordsets there is a .FindFirst
    Alternatively you can create your own custom search using VBA - you can adapt it to do whatever you want!
    George
    Home | Blog

  4. #4
    Join Date
    May 2007
    Posts
    74
    OK, I may be stuck with building my own Find Dialog box just to get the "Find First" button. So much for the easy way out.

    That's cool ... I consider it a learning opportunity.

    So, I have a couple of questions to start my learning:
    1. The "Look In:" combo box seems to get pre-filled with the names of the currently selected control, and the name of the currently selected form (I think). How do I get this information? I don't think the Screen.ActiveControl property will work, since a "Find" button on the main form will be pressed to bring up my new find dialog - causing the focus to shift to the "Find" button and leave the original control.
    2. What is the logic behind enabling the "Search Fields as Formatted" checkbox?


    Cheers!
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm afraid to say I have no idea what you're asking...
    If you're wanting to know what form you have clicked the find button from then I suggst you use a function which you can call from each button.
    Code:
    Function Find(FormName As String)
     MsgBox FormName
    End Function
    
    Private Sub cmdClick_Click()
     Call Find(Me.Name)
    End Sub
    George
    Home | Blog

  6. #6
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    If the user doesn't attempt to change anything in that screen, but just types in a search string, the Find will look in the form's record source for the data, which is no doubt what you want.

    The only issue is how to 'command' the user not to change the default.

    Hence the command button/InputBox routine I mentioned above....

    Sam

  7. #7
    Join Date
    May 2007
    Posts
    74
    georgev - The existing code uses a "DoCmd.DoMenuItem A_FORMBAR, A_EDITMENU, 10, , A_MENU_VER20" line to open up a standard Access Find/Replace Dialog for the user. The main form is based on a table in the database.

    Let's say that the user is in a form called "Update CRs". When they press the "Find Record" button on the "Update CRs" form, the standard Find/Replace dialog opens, and the "Look In:" field will contain "Update CRs" (and be disabled). But, sometimes the "Look In:" field will contain "Update CRs" and the title of the field the user was just in, and "Look In:" will be enabled to allow the user to choose what they want to search in (whole table, or just the field).

    Since the users want an exact look-alike Find form, I am trying to duplicate the standard Find/Replace dialog functionality.

    One thing I will need to do is pass the currently selected form name onto my new Find form. How is this done?

    AzJazz
    Last edited by azjazz; 07-11-07 at 18:13.
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by azjazz
    One thing I will need to do is pass the currently selected form name onto my new Find form. How is this done?
    See post #5?
    George
    Home | Blog

  9. #9
    Join Date
    May 2007
    Posts
    74
    Quote Originally Posted by georgev
    See post #5?
    Yep.

    But, I didn't think it through properly the first time I saw it. My mind is clearer now, and I have a better idea on what to do now.

    Sorry for bugging y'all on this.

    AzJazz
    AzJazz

    "I'm afraid the holodeck will be society's last invention." - Scott Adams

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Hehe, no worries!
    We're all guilty of it

    Let us know how you get on with this - I'd be intrigued to see the final result!
    ~George
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •