By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,689 Members | 1,915 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,689 IT Pros & Developers. It's quick & easy.

Getting the record from a datasheet to display on another form

P: 2
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.
Jan 8 '15 #1
Share this Question
Share on Google+
3 Replies


jforbes
Expert 100+
P: 1,107
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:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "OrderForm", , , "OrderNumber=" & Me.SubformName.Form!OrderNumber
Jan 8 '15 #2

P: 2
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
Jan 13 '15 #3

jforbes
Expert 100+
P: 1,107
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.
Jan 14 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.