Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    26

    Unanswered: Default Value / Subforms

    I would like a form that opens via a command button to display a value in a subform on the form that contains the command button.

    For example the field I would like to capture is EmployeeID and it is located on Subform_Employees (this subform is located on Form_Main). When I click on the Command Button (part of Subform_Employees) another form opens up (Called Form_Dialog) which has a foreign key of EmployeeID. I want EmployeeID on the Form_Dialog form to be the same as the value shown in Subform_Employees when the command button is pressed.

    Thanks,
    David

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    After you open the form, use a command like:

    Forms!Form_Dialog!EmployeeID = Forms!Form_Main!Subform_Employees.Form!EmployeeID

    Something like that anyway.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You could also open the Form_Dialog form passing it a WhereCondition argument:

    Code:
    DoCmd.OpenForm "Form_Dialog", , , "EmployeeID = " & Me.Subform_Employees.Form!EmployeeID, , acDialog
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •