Results 1 to 5 of 5
  1. #1
    sevanty7 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    37

    Question Displaying information of searched record in form

    Hello



    I currently have a form called frmEditRecord
    on this form i have a search bar in which users can go and type in the retrieval code for a record they are searching for. Once they type in the code and hit the find button i currently have it set to open up the related record in a query in which the information is located.
    What i want to have it do is that instead of displaying it in the table/query view it retrieves the information and then displays the record in the textboxes I have added to the initial search form (frmEditRecord).
    Once it is set that the information displays in the textboxes I then need to have a save button so users can edit the record they searched for and save it.

    Thanks for any help or hints you can provide!

  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
    Why not let Access do all the heavy lifting for you, and use a Combobox?

    If you haven't already done so, create a Form based on your Table, including all the Fields you want displayed.

    Then simply:

    • Add a Combobox to your Form.
    • The Combobox Wizard will pop up
    • Select "Find a record based on the value I selected in my combobox."
    • From the Table the Form is based on, click on the Field you're searching by (a Field that is unique for each Record, such as your Retrieval Code) to move it to the right side.
    • Hit Next.
    • Size the column appropriately.
    • Hit Next.
    • Name the Combobox something appropriate.
    • Hit Finish.

    Now you can drop the Combobox down and scroll down to the appropriate Retrieval Code to search by, or you can start to enter the Retrieval Code (just like you would in your Textbox) and the Combobox will "autofill" as you type. Hit <Enter> and the Record will be retrieved.

    Since the Form is Bound to your Table, saving the Record doesn't require a 'save' button; simply search and move to another Record, close the Form, or close Access, itself, and the newly edited Record will be automatically saved.

    If you want a 'blank' Record when first opening the Form, add this to your code module for the Form:

    Code:
    Private Sub Form_Load()
     DoCmd.GoToRecord , , acNewRec
    End Sub


    Linq ;0)>

  3. #3
    sevanty7 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    37
    Thank you! that works way better, how would i go about making it so that once i pick an option from the combobox it displays the other fields of the same record in textboxes I placed below on the same form?

  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
    Quote Originally Posted by sevanty7 View Post

    ...how would i go about making it so that once i pick an option from the combobox it displays the other fields of the same record in textboxes I placed below on the same form...
    As I said before:

    Quote Originally Posted by Missinglinq

    ...If you haven't already done so, create a Form based on your Table, including all the Fields you want displayed.
    In other words, set the Form's RecordSource to the underlying Table and set the ControlSource of each of your Controls to the appropriate Field of that Table.

    The Data will then be retrieved into the appropriate Controls and ready to be edited.

    Linq ;0)>

  5. #5
    sevanty7 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    37
    Thanks for the help, when i tried making the record source like you said and ran the combobox it still wasn't working properly possibly because i have the information spread across two different tables.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-13-2013, 06:13 PM
  2. Replies: 1
    Last Post: 11-28-2012, 01:33 PM
  3. Replies: 6
    Last Post: 06-10-2012, 04:28 AM
  4. Replies: 3
    Last Post: 04-25-2012, 02:14 PM
  5. Replies: 1
    Last Post: 01-20-2012, 04:31 PM

Tags for this Thread

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