Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Count for totals

Discussion in 'Information Technology' started by Roger Bell, Nov 8, 2005.

Tags:
  1. Roger Bell

    Roger Bell
    Expand Collapse
    Guest

    I have inherited a data base that is not truly relational and already has
    loads of data in it. There are 6 seperate fields for Children's names EG:
    Namechild1, Namechild2 etc etc. There is then a text box called Number of
    children in family which has to manually added (no big deal i guess) and the
    number enter into this field. Is there any way I can write some code in this
    text box that will automatically count the number of children for each
    record, which will naturally change then as children are added or deleted.
    Thanks for any help
     
  2. Loading...

    Similar Threads Forum Date
    Ashdoc's Movie Review---The Accountant Theatre, Movies & Cinema Oct 21, 2016
    Gurmat Vichaar | Futility Of Counting Paaths | April 12, 2016 Gurmat Vichaar Apr 23, 2016
    wolf count Blogs Oct 17, 2015
    recount Blogs Oct 17, 2015
    Events Banda Singh Bahadur's Martyrdom - An Eyewitness Account History of Sikhism Mar 26, 2015

  3. Larry Linson

    Larry Linson
    Expand Collapse
    Guest

    "Roger Bell" wrote

    > I have inherited a data base that is not truly relational
    > and already has loads of data in it. There are 6 sep-
    > erate fields for Children's names EG: Namechild1,
    > Namechild2 etc etc. There is then a text box called
    > Number of children in family which has to manually
    > added (no big deal i guess) and the number enter
    > into this field. Is there any way I can write some
    > code in this text box that will automatically count
    > the number of children for each record, which will
    > naturally change then as children are added or deleted.


    You can write code in a standard module, if you wish, and call that from
    within a Query, to count those fields.

    You can write code, but not in the bound TextBox... calculated Controls
    cannot be bound. You could have a Calculated Text Box on your Form, unbound,
    and then copy the value to a bound Text Box.

    Basically the code for a calculated Text Box will look something like this
    (air) code:

    = IIF(Not IsNull(txtChild1), 1, 0) +
    IIF(Not IsNull(txtChild2), 1, 0) +
    IIF(Not IsNull(txtChild3), 1, 0) +
    . . .
    IIF(Not IsNull(txtChildN),1,0)

    You may have to fully-qualify the reference if it is not patently obvious to
    Access that "txtChild1" refers to a Text Box.

    In the Form's module you can use the Me!txtChildN notation, simplifying the
    qualification of the reference.

    BUT, it might be a lot better in the long-run if you would invest a little
    more time, some Queries, and perhaps a little code, in extracting what
    appears to be related child information into a related table.

    Larry Linson
    Microsoft Access MVP
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page