calculated form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paolo

    calculated form

    Friends, I have a table with a field named Initials which has its
    record source to another table named Initials.
    I would like to add on a form named Welcome two controls:
    A combo box, which displays the initials of all my database users and
    a text box which calculated the number of records associated to the
    selected user.

    I would like to use the OnChange event of the combo to run the query
    or the calculation code.

    Is there a way I can do this?

    Thanks.
  • Wayne Morgan

    #2
    Re: calculated form

    Add the combo box to the form. Set its Row Source to a query that returns
    the initials from the table that lists the initials. The wording in your
    first sentence is confusing. Is the Initials field the field that the two
    tables are joined on? Is the table that lists the initials also called
    initials?

    Example:
    SELECT [Initials].[Initials] FROM [Initials] ORDER BY [Initials]

    Then add the textbox. Set the Control Source of the textbox to

    =DCount("*", "[NameOfOtherTabl e]", "[Initials]='" & cboNameOfCombo & "'")

    This will make the textbox a calculated control. You shouldn't need a VBA
    event to do this.

    --
    Wayne Morgan
    Microsoft Access MVP


    "Paolo" <jprma@tin.it > wrote in message
    news:9f41a860.0 408040615.4f7a4 552@posting.goo gle.com...[color=blue]
    > Friends, I have a table with a field named Initials which has its
    > record source to another table named Initials.
    > I would like to add on a form named Welcome two controls:
    > A combo box, which displays the initials of all my database users and
    > a text box which calculated the number of records associated to the
    > selected user.
    >
    > I would like to use the OnChange event of the combo to run the query
    > or the calculation code.
    >
    > Is there a way I can do this?
    >
    > Thanks.[/color]


    Comment

    • Reggie

      #3
      Re: calculated form

      One other way would be to use a totals query for the source of your combo.
      In the query add the Initials field twice to the control grid. Under the
      first set it to GroupBy under the second set it to Count. Now set the
      control source of you unbound text box on your form to:
      =([MyCombo].Column(1))

      --
      Reggie

      ----------
      "Wayne Morgan" <comprev_gothro ughthenewsgroup @hotmail.com> wrote in message
      news:fy7Qc.318$ Ha1.194@newssvr 17.news.prodigy .com...[color=blue]
      > Add the combo box to the form. Set its Row Source to a query that returns
      > the initials from the table that lists the initials. The wording in your
      > first sentence is confusing. Is the Initials field the field that the two
      > tables are joined on? Is the table that lists the initials also called
      > initials?
      >
      > Example:
      > SELECT [Initials].[Initials] FROM [Initials] ORDER BY [Initials]
      >
      > Then add the textbox. Set the Control Source of the textbox to
      >
      > =DCount("*", "[NameOfOtherTabl e]", "[Initials]='" & cboNameOfCombo & "'")
      >
      > This will make the textbox a calculated control. You shouldn't need a VBA
      > event to do this.
      >
      > --
      > Wayne Morgan
      > Microsoft Access MVP
      >
      >
      > "Paolo" <jprma@tin.it > wrote in message
      > news:9f41a860.0 408040615.4f7a4 552@posting.goo gle.com...[color=green]
      > > Friends, I have a table with a field named Initials which has its
      > > record source to another table named Initials.
      > > I would like to add on a form named Welcome two controls:
      > > A combo box, which displays the initials of all my database users and
      > > a text box which calculated the number of records associated to the
      > > selected user.
      > >
      > > I would like to use the OnChange event of the combo to run the query
      > > or the calculation code.
      > >
      > > Is there a way I can do this?
      > >
      > > Thanks.[/color]
      >
      >[/color]


      Comment

      Working...