Getting the record from a datasheet to display on another form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vickimiller00
    New Member
    • Jan 2015
    • 2

    Getting the record from a datasheet to display on another form

    Database: customer table; orders table; quote history table
    I have a form to enter the orders saves to the orders table. User wanted a "look-up" screen to search for the right order. The look-up form has fields the user fills in with criteria for query. Results are displayed in a sub-form. I need to know how to enter code to grab the record the user clicks on in the sub form and display all the data in my order form. I've tried using current record but it just keeps giving the first record in the table.
  • jforbes
    Recognized Expert Top Contributor
    • Aug 2014
    • 1107

    #2
    If I understand correctly, you are attempting to Open a Form and Filter it based on a key in a Subform.

    To find the value of the key in the Subform, there is this handy dandy reference that is posted on here a lot that should help you if needed: http://access.mvps.org/access/forms/frm0031.htm

    To Filter a Form while opening it, or even just to Filter it from another Form, you can use the DoCmd.OpenForm Method . Kinda like this:
    Code:
    DoCmd.OpenForm "OrderForm", , , "OrderNumber=" & Me.SubformName.Form!OrderNumber

    Comment

    • vickimiller00
      New Member
      • Jan 2015
      • 2

      #3
      Thank you for your response. Where on the reference paper is the record number the user clicked on? I thought I was to look for a record selector index, that the record selectors are part of access and not a field i created. my main form is proposal, the user can click on a find button; it fires the OnClick event procedure that has this command: DoCmd.Open Form "SearchProposal "
      SearchProposal Form has a sub form named ProposalList. It's Row Sorce TYpe is Table/View/StoredProc with a select statement to display the proposal records. I have some fields at the top of the SearcProposal form where the user can narrow the criteria for the proposal list. Once the user has narrowed the list and click on one of the proposals displayed in the subform ProposalList; I need to get that record and display it back on the original Proposal from. Im not getting the correct record number. WHat am i doing wrong

      Comment

      • jforbes
        Recognized Expert Top Contributor
        • Aug 2014
        • 1107

        #4
        Typically, the Primary Key of the Table for the underlying Form is used. It would most likely be specific to your Database/Table. In your case, I would guess it is something like OrderNumber or a similarly named unique number/field.

        Comment

        Working...