Results 1 to 6 of 6
  1. #1
    ryanmce92 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    48

    Search for data in a table NOT via a query

    I'd like to add a button which will search for the data entered in the table and bring it up on the form.

    I don't want this to come up in the datasheet view I'd like it to appear on the form itself.

    E.g I have an Add A Category form, when a user goes into this I'd like to give them the option to click this "button" and search for the category which they would like to edit. This is to eradicate spelling mistakes etc.

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    Your post is somewhat confusing. I believe you want to use a combobox control and/or possibly set up your table fundamentally with this field being a 'look up' field type...

  3. #3
    ryanmce92 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    48
    I have the idea in my head, putting on a screen is different so apologies haha.

    The reason I want this is to give my users the ability to edit the different "categories".

    Something similar to the Find/Replace function that would be used in Excel?

    So the user clicks this button and a search box appears when they type in the "category" it brings that "category" on screen and allows them to edit that category, so when they are trying to add something to the database and they see a spelling mistake in one of the "categories" then they are allowed to edit it.

  4. #4
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    I will reply with this example:
    Category is a table - it can have a form so users can enter/edit categories. this table has 2 fields; an auto number key field and the text field

    Products is a table - and 1 of its fields is 'Category' which is a look up field type to the Category table. What displays is the text but what actually links them is the key.

    In the form for the Products table the Category field will automatically be a drop down combo box.

    Because the key field is stored - any misspelling/edit in Category form/table - once corrected/edited - will display corrected/edited in all Product records

  5. #5
    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
    Presumably the Form is already based on the Category Table. You can do this with a Combobox; replacing all Table, Field and Controls names with your actual names:

    Place a Combobox on your Form

    When the Wizard comes up hit Cancel

    With the Combobox Selected, go to Properties – Data and place this in the RowSource Property
    Code:
    SELECT [CategoryTableName].[Category], [CategoryTableName].[Company] FROM CategoryTableName;

    Now place this code in the code module for the Form:
    Code:
    Private Sub cboFindCategory_AfterUpdate()
     
    Dim rs As Object
    
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[Category] = '" & Me![cboFindCategory] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    
    End Sub

    Select the category, as currently spelled, and the Record for it will be retrieved.

    Linq ;0)>

    $%^&*( Running too slow today!

  6. #6
    ryanmce92 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    48
    Perfect Cheers!.

    One thing is that I also have a table called "Add A Supplier". This allows the user to add a supplier with the usual contact details etc. How would I go about having all the details appear in the corresponding fields on the form when I select the supplier from a combo box at the top of the form?.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-24-2015, 11:49 AM
  2. Replies: 1
    Last Post: 03-07-2013, 03:21 PM
  3. Replies: 2
    Last Post: 12-17-2012, 03:46 PM
  4. Search table in form / edit data in form
    By Guitarzan in forum Access
    Replies: 3
    Last Post: 10-02-2012, 11:37 AM
  5. Replies: 12
    Last Post: 03-22-2012, 02:48 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