Results 1 to 3 of 3
  1. #1
    Kmez is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    3

    How do I create a search function that then takes you to the chosen record?


    I am very new to databases and am blundering my way though creating a new database and learning as I go so any help is appreciated.

    I want to be able to create a 'start' screen in which the user has several choices. One thing I want to do on the 'start' screen is create a 'search' function in which the user can type in a surname or reference number and this then opens up the relevant record that they can view/amend.

    How would I go about this?

    Thanks

  2. #2
    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
    By using a Combobox for each Field you want to use to search on. The Combobox Wizard will do most of the heavy lifting for you:

    If you haven't already done so, create a form based on your table or query, including all the fields you want displayed. Then simply:

    1. Add a Combobox to your Form.
    2. The Combobox Wizard will pop up
    3. Select "Find a record based on the value I selected in my combobox."
    4. From the Table or Query the Form is based on, click on the Field you're searching by (a Field that is unique for each Record) to move it to the right side.
    5. Hit Next.
    6. Size the column appropriately.
    7. Hit Next.
    8. Name the Combobox something appropriate.
    9. Hit Finish.

    Now you can drop the Combobox down and scroll down to the item to search by, or you can start to enter the item, and the Combobox will "autofill" as you type. Hit <Enter> and the record will be retrieved.

    If you want the Form to be blank when it first opens, use this code to move to a New Record:

    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

  3. #3
    Kmez is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    3
    Thanks missingling, that's really helpful.

    However, how do I set up a combo box that relates to a field in a different table? Is this possible?

    Thanks!

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

Similar Threads

  1. Replies: 5
    Last Post: 07-13-2012, 01:15 AM
  2. Replies: 4
    Last Post: 08-05-2011, 07:27 AM
  3. Search for Record, create new if not existant
    By asmith in forum Programming
    Replies: 3
    Last Post: 09-28-2010, 11:31 AM
  4. Replies: 6
    Last Post: 07-19-2010, 10:57 AM
  5. Replies: 3
    Last Post: 03-22-2010, 04:30 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