Results 1 to 3 of 3
  1. #1
    SyuRi is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2

    Creating a new record on a form maintaining one of the keys


    I'm creating a database on Access where to manage the products some farmers have. Now, i created a form from a table that relates the FarmerID with ProductID (both primary keys). I put a button to create a new record, but as expected, it asks the input of the FarmerID and ProductID. I wanted that by clicking the "add new product" button, it would already know it's for the Farmer i'm vieweing, so i would only need to input the ProductID. How can i do it?

    Click image for larger version. 

Name:	1.JPG 
Views:	2 
Size:	35.1 KB 
ID:	12279Click image for larger version. 

Name:	2.JPG 
Views:	2 
Size:	21.2 KB 
ID:	12280Click image for larger version. 

Name:	3.JPG 
Views:	2 
Size:	32.9 KB 
ID:	12281

    Relevant info: For each farmer i click on "manage products", where i put the condition [FarmerID]=[Forms]![F_Farmer]![FarmerID], so that the manage products window only shows entries with FarmerID = the one i selected. Now clicking on the new entry, as it shows on the 3rd pic, has neither FarmerID nor ProductID, but if the Farmer is FarmerID=2 like the pictures i wanted to add the product for that farmer without having to enter FarmerID again.

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    1. Design a separate Form for Manage Products (a contineous Form is better)and insert it on the Main Form as a sub-form.
    2. Click on the sub-form to select it.
    3. Display it's Property Sheet (F4).
    4. Type FarmerID on the Link Master Field Property.
    5. Type FarmerID on the Link Child Field Property (assuming that you have a FarmerID field on the Products Table and don't define this as Primary Key).
    6. Save the Forms and open the Main Form in Normal View.
    7. Select a FarmerID on the Main-Form.


    You will see the same FarmerID is appearing on the Sub-Form also.

  3. #3
    SyuRi is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2
    Thank you it worked

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

Similar Threads

  1. Creating Short Cut Keys
    By djclntn in forum Access
    Replies: 1
    Last Post: 11-21-2012, 04:41 PM
  2. Replies: 3
    Last Post: 09-25-2012, 05:24 PM
  3. Have a form look up field when creating a record
    By mattmurdock in forum Forms
    Replies: 1
    Last Post: 06-28-2012, 01:40 AM
  4. Replies: 1
    Last Post: 05-19-2012, 03:51 PM
  5. Combo boxes both primary keys to select record
    By Alexandre Cote in forum Forms
    Replies: 3
    Last Post: 08-10-2010, 07:11 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