Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1

    Unanswered: Post No Of Records In a Box on Form

    HI .. can anyone help with a snipet of something (not sure if it is code, SQL or an expression, .. yes I really don't know the difference) which will retrieve he number of records in a table and post the answer in a text box?

    I have the text box on a form; I click in the Control Source in properties and paste something like

    SELECT Count(*) AS Expr1 FROM ("CTO_NRC") where CTOxx is the table name.

    however the page then returns NAME? when it runs?

    clues very much appreciated...

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    remove the (" from the table name

    Code:
    SELECT Count(*) AS NoRecords FROM CTO_NRC;
    assuming that CTO_NRC is the table name

    or if you are building this as SQL then
    Code:
    strSQL = "SELECT Count(*) AS NoRecords FROM " & CTO_NRC & ";"
    ..assuming that CTO_NRC is a variable containing the table name
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Hey healing One....

    thanks for that. I paste that into the Control Soure field, of the properties of my text box and the same error - Hash sign Name?

    Is that field for EXPRESSIONS only and we talking SQL and Code here?

    Could that be it?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    In the Property window when the form is in Design view, type (or paste) this in the ControlSource property of the Textbox:
    Code:
    =DCount("*";"CTO_NRC")
    Note: You'll perhaps need to replace the semicolon (;) by a comma (,).
    Have a nice day!

  5. #5
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Holy Heck ...... too too good!

    THAT is fabulous.

    Again.. appreciate the effort.

Posting Permissions

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