Results 1 to 4 of 4
  1. #1
    gio25 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2011
    Posts
    2

    SearchBox and Datasheet View

    Hi everyone

    I have 2 questions

    Anyone has used the students template in access 2007/2010??

    If someone has used, how is that the search box works?


    I trying to adapt this search box to my database and I can't make it work is there a better alternative?

    Also my form displays in datasheet view, if I filtered the data, how can I make a query out the displayed data only??

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Feb 2009
    Posts
    235
    Could you post the students database saved as 2000 mdb format for testing?

  3. #3
    161 is offline L33t N00b
    Windows 2K Access 2003
    Join Date
    Dec 2010
    Posts
    33
    I do not have that search box, but from the description I would bet it is a QBF. I made one in my database, and its pretty simple to me now anyway. I had to figure this out myself, and if you asked me a few weeks ago, my face looked like this. But I owe a lot to everyone on here that helped me, so I'm returning the favor!

    You can look up examples of "Query By Form". Or follow these simple steps to make one.

    First, create a command button on your form. A window will pop up, but just X it out, we're flying manually today. Right click and go to properties, event, on click and hit the (...) to build your code. Some of the code is already written in for you. After the Private Sub line, you need:

    stDocName = "your query name"
    DoCmd.OpenQuery stDocName, acNormal

    (if you want your search results to be uneditable, put ", acReadOnly" after acNormal)

    Second step is to make your form fields. Very simple, create a text box with the right field unbound. Example: Give it a name.... "SearchField1", but leave the other fields blank, so it is not connected to a table.

    Finally, you create your query. Go into the design view and select the field you want to be searching for and the table that its found in. Under Criteria, enter this:

    Like [Forms]!(your form name)!(SearchField1)

    Or, if you want to include a wildcard (will return a field "Pink" if you do a search for "Pin"

    Like "*" & [Forms]!(your form name)!(SearchField1) & "*"

    You are also free to fill up your other query fields at your hearts desire, so you will get more than one column of useful information in your search result. You may put a similar thing in the criteria for those fields as well, and it will narrow down your results to the fields in common. Example field 2 search is "Panther". You will return only the strings that are both "pink" AND "panther".
    Last edited by 161; 03-15-2011 at 09:39 AM. Reason: Just realized, you don't need the macro. That was me messing around with mine.

  4. #4
    chasemhi is offline Novice
    Windows Vista Access 2003
    Join Date
    Feb 2011
    Posts
    5
    Quote Originally Posted by 161 View Post
    Like "*" & [Forms]!(your form name)!(SearchField1) & "*"
    You could also allow your user to enter the wildcards. For example, they enter pin* and they would get pink.

    Nice mini tutorial BTW. Thanks.

    Chase

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

Similar Threads

  1. Missing Columns in Datasheet View
    By mikel in forum Access
    Replies: 3
    Last Post: 01-02-2015, 01:57 PM
  2. Subform, Totals, in Datasheet view
    By eww in forum Programming
    Replies: 1
    Last Post: 09-27-2010, 10:22 AM
  3. vertical text in datasheet view?
    By johncinpcb in forum Forms
    Replies: 0
    Last Post: 06-14-2010, 07:14 AM
  4. Datasheet View
    By Evgeny in forum Programming
    Replies: 6
    Last Post: 04-28-2010, 10:17 AM
  5. Form - Datasheet View
    By kalove in forum Forms
    Replies: 0
    Last Post: 06-20-2007, 11:29 AM

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