Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85

    Search Combo Box on Form

    Seach Combo Box CompanyType
    I need to have the list that appears be just the distinct types

    Advertising
    Web
    Shipping
    Shipping
    Other
    Advertising
    Web

    I want the list to be distinct rather than all records to do the search from - it should be as follows:


    Advertising
    Shipping
    Other
    Web

    The combo box data is a field on form also

  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,530
    Typically those would come from a table of company types. If you're trying to get it from a transaction table:

    SELECT DISTINCT CompanyType FROM TableName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    It is in a combo box that I am using to search for a specific CompanyType - I used the wizard to create the search. Now I am also having a problem with the form because I am using it for data entry and for searching. If I turn the dataentry to yes - then the search does not work - I am not sure how to have both things work in the same form.
    I tried putting Me.DataEntry = False in the on-click of a button but I get a compile error - I am getting confused

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Why are you setting Data Entry to 'Yes?' This setting only allows the entering of New Records, not the viewing of existing Records

    No Viewing = No Searching

    BTW, setting Data Entry to 'Yes,' despite its name, is not needed to enter Data! With Data Entry set to 'No,' AllowEdits = Yes/True and AllowAdditions = Yes/True, you can add new Records, edit Records and search Records.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I have it set to no - I would like the form to open with a new record
    I am getting this error with my search box also
    Click image for larger version. 

Name:	a.jpg 
Views:	12 
Size:	102.9 KB 
ID:	11591

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    The error would imply you have code somewhere it shouldn't be. In the VBA editor, hit Debug/Compile and fix any problems it shows.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I did find the end sub that was there - but I still have the problem of opening the form in a New Record and still be able to use the search box or scroll through the data.

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Look at GoToRecord in VBA help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I'm not very good at VBA - where would I find the help

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acNewRec
    End Sub


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  11. #11
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    Where do I put this code? I'm sorry I am really new to the coding

  12. #12
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I got it - thank you very much So easy yet so frustrating. The only problem I have is that it goes to my combo search box when the form is opened - can I direct it to another field?

    If I am in Access and want to look up VBA code help - where would I find it?

  13. #13
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    Got it - is there a good reference for VBA Code? I used: DoCmd.GoToControl "ContactLastName"

    If I am in Access and want to look up VBA code help - where would I find it?

  14. #14
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Rhubie View Post
    If I am in Access and want to look up VBA code help - where would I find it...
    While in the Code Module of any Form, place term(s) in the search box at the top, right of the window. If a list of pertinent help topics pops up, choose the one that seems the most appropriate.

    For a specific command, property, etc, place the cursor in the middle of said command or property and hit <F1>. If more than one topics pops up, once again, try the most pertinent.

    Here's some sites, listed from the easiest to understand to the more difficult, that go into the nuts and bolts of development, after you get a handle of table design.

    Chrystal has an excellent “basics” tutorial:

    http://www.accessmvp.com/strive4peace

    This is a little more advanced, but still a great starting point, having 28 well written, well defined, clearly named chapters.
    :
    http://www.functionx.com/vbaccess/index.htm

    Jeff Conrad's resources page:
    http://www.accessmvp.com/JConrad/acc...resources.html

    The Access Web resources page:
    http://www.mvps.org/access/resources/index.html

    MVP Allen Browne's extensive list of tutorials and on-line reference materials:
    http://allenbrowne.com/links.html#Tutorials


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  15. #15
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    Thank you very much for your help

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

Similar Threads

  1. Replies: 7
    Last Post: 08-08-2012, 03:28 PM
  2. Search form combo box filter
    By whojstall11 in forum Forms
    Replies: 1
    Last Post: 07-06-2012, 02:04 PM
  3. Combo Box Search Form
    By timbo in forum Forms
    Replies: 2
    Last Post: 04-25-2012, 02:56 PM
  4. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  5. Combo Search Form
    By Filmnoir in forum Forms
    Replies: 26
    Last Post: 01-26-2012, 10:12 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