Access Subforms - Passing in form values to a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robtyketto
    New Member
    • Nov 2006
    • 108

    #1

    Access Subforms - Passing in form values to a query

    Greetings,

    I have a form where a combo box is used to select a name and Id.

    Theses values are passed into a subform.

    However the query now returns 0 results.
    So I edited the query and hard coded the same value as can be seen in the table and rows retrieved.

    Now in the form I get strange behaviour where 1 out of 5 times I get results results. Are sub forms buggy when reference form fields as follows:-
    [Forms]![frmModuleResult s]![txtModuleId]

    I capture the values in VBA of the form control and they are exaclty as they should be and if hardcodied into the results, rows are retreived.

    Really frustrated.

    Any tips or advice?

    Cheers
    Rob
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by robtyketto
    Greetings,

    I have a form where a combo box is used to select a name and Id.

    Theses values are passed into a subform.

    However the query now returns 0 results.
    So I edited the query and hard coded the same value as can be seen in the table and rows retrieved.

    Now in the form I get strange behaviour where 1 out of 5 times I get results results. Are sub forms buggy when reference form fields as follows:-
    [Forms]![frmModuleResult s]![txtModuleId]

    I capture the values in VBA of the form control and they are exaclty as they should be and if hardcodied into the results, rows are retreived.

    Really frustrated.

    Any tips or advice?

    Cheers
    Rob
    Rob,
    I am not certain whether you used the master/child links to auto connect the main form and the child form. I am also not clear whether you are executing code on the main form to drive the subform. If you are, then you would reference the subform like one of these options:

    Reference a control on the subform:
    Forms!YourMainF orm!YourSubform Control.Form!Yo urControl
    Me!YourSubformC ontrol.Form!You rControl

    Reference a method to be executed on the subform
    Me!YourSubformC ontrol.Form.Req uery

    Hope this helps. If not provide more details.

    Comment

    • robtyketto
      New Member
      • Nov 2006
      • 108

      #3
      Thanks for all the advice, requery function help me too.

      Comment

      Working...