Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68

    Help with search form


    Hi!

    I would like to make a search form (see example attached). But I can't really figure out how to actually do it. I thought of having different querys but it feels like there's gonna be too many (I'm gonna have moore search options in my actual database).

    So do you have any tips on how I need to proceed? There should be a lot of these formes done and maby there's some tutorial for it but I can't find it

    Thanks

    /Jonas

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Your attachment didn't get attached.

    Check this tutorial http://datapigtechnologies.com/flash...earchform.html
    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
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Thanks a lot! That video really helped!

    There is one thing that doesn't work for me though.
    I'm using drop down boxes that are connected to different databases, i e one database with users and one with rooms.
    I am able to search using their information, but only if I chose a value in all of them. If I want to see all the equipment "user A" is using, I don't want to specify which room. If I don't chose a room as well as the user, there is no result.

    Why is that?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    You mean the comboboxes RowSources are from different tables? That is not a problem. That tutorial method should allow for non-selection in any combobox. Show the SQL statement of the query that uses these comboboxes as parameters.
    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
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Yeah, I know, it actually works.
    But I don't want to be forced to pick a choice in every drop down box to get a result. As it is now, I don't get any result at all if I only pick, i e a room. I need to chose a room, a user and all the rest to get an answer.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    My point is should not have to enter all comboboxes if form RecordSource set up as shown in tutorial.

    Only way I can give further help is to review your project if you want to provide. Make copy, remove confidential data, run Compact & Repair, zip if still large, attach to 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.

  7. #7
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Unforunatly I won't be able to access the files until monday, but I'll keep in touch!

  8. #8
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Now I'm back! And here is the database.
    If you try to search the Product-ID "1" you won't get any hits. But if you also chose "Computer", "Room 2" and "User 2" from the drop downs you'll get a hit. Do you see my problem?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    You need the Like operator for all criteria in the query. Review the tutorial video again.
    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.

  10. #10
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Wow, unbelievable... I know I tried that! Anyway, now it works, thanks!

    But now the results turn up in a new window. How do I make them show in a sub form in the same window?

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    The tutorial shows opening query. You can make the subform's RecordSource the query with the parameters. And don't use code that opens query. Instead requery the subform. A subform might not be needed. You can put the search controls in form Header and set form to Continous View and arrange controls in Detail section to appear like Datasheet.
    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.

  12. #12
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    I think I know how to do all of this, except to requery the subform.
    As it is now, I have a subform in Detail that is connected to the query. But how do I tell the "search" button not to open a new form, but just to update the subform?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    I always give subform container name different from the form it holds, like: ctrInvoiceDetails.

    Then try code:
    Me.SubformContainerName.Form.Requery
    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.

  14. #14
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    It works perfectly fine! =)

    Thanks a lot!

  15. #15
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    Sorry, there is just one more thing that I think is no big deal...

    I added a search field for serial numbers for the computers. And I can use it to search, but when every field is empty I want all posts to show. But right now (when I added the SN field) only the posts that doesn't have empty SN fields are visible. And since not every unit has a SN, some fields are empty. And they are not showing...
    How to solve that?

    /J

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

Similar Threads

  1. Replies: 7
    Last Post: 11-16-2011, 01:22 PM
  2. Search Form
    By roger556 in forum Forms
    Replies: 5
    Last Post: 07-16-2011, 02:11 PM
  3. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  4. Search on in a form
    By newtoAccess in forum Access
    Replies: 2
    Last Post: 12-08-2010, 11:28 AM
  5. Search Form VBA
    By rcdugge in forum Programming
    Replies: 2
    Last Post: 07-20-2010, 02:57 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