Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Adding detail textboxes in access reports

scottscott Member Posts: 4
Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!

Thanks
Scott

Comments

  • compuchipcompuchip Member Posts: 273
    I don't think it is possible.
    The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    [code]
    Sub Report_Open()
    Dim rst As RecordSet
    Dim textfield as String
    Set rst = CurrentDb.OpenRecordSet("Equations")
    rst.MoveFirst
    Do Until rst.EOF
    textfield = textfield & rst.Fields(0)
    rst.MoveNext
    Loop
    rst.Close
    ' I assume you're on the Report, so I used Me. here
    Me.MyIndependentTextField = textfield
    [/code]

    : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    :
    : Thanks
    : Scott
    :

  • splansingsplansing Member Posts: 140
    Here's a thought. If you can, put the equation in your recordsource, so that your "equation of sorts" comes out as a field, already calculated. Then you can use the SUM function in your footer and it should work.


    : I don't think it is possible.
    : The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    : [code]
    : Sub Report_Open()
    : Dim rst As RecordSet
    : Dim textfield as String
    : Set rst = CurrentDb.OpenRecordSet("Equations")
    : rst.MoveFirst
    : Do Until rst.EOF
    : textfield = textfield & rst.Fields(0)
    : rst.MoveNext
    : Loop
    : rst.Close
    : ' I assume you're on the Report, so I used Me. here
    : Me.MyIndependentTextField = textfield
    : [/code]
    :
    : : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    : :
    : : Thanks
    : : Scott
    : :
    :
    :

  • RikRik Member Posts: 56
    Good idea. You can have a field in the reports query like 'EOS: EOS([ANumber])', where ANumber is the field that you perform EOS on (of course you can pass as many fields as you need) and EOS is a public function in acode module. So you can [italic]always[/italic] have the result of [b]any[/b] equation/function as a column in a query.

    : Here's a thought. If you can, put the equation in your recordsource, so that your "equation of sorts" comes out as a field, already calculated. Then you can use the SUM function in your footer and it should work.
    :
    :
    : : I don't think it is possible.
    : : The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    : : [code]
    : : Sub Report_Open()
    : : Dim rst As RecordSet
    : : Dim textfield as String
    : : Set rst = CurrentDb.OpenRecordSet("Equations")
    : : rst.MoveFirst
    : : Do Until rst.EOF
    : : textfield = textfield & rst.Fields(0)
    : : rst.MoveNext
    : : Loop
    : : rst.Close
    : : ' I assume you're on the Report, so I used Me. here
    : : Me.MyIndependentTextField = textfield
    : : [/code]
    : :
    : : : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    : : :
    : : : Thanks
    : : : Scott
    : : :
    : :
    : :
    :
    :
  • Andre YoungAndre Young USAMember Posts: 0

    _____ < http://forcoder.org /> free video tutorials and ebooks about [ Visual Basic .NET, C++, C#, Java, PHP, Swift, Ruby, JavaScript, MATLAB, Python, Go, C, Perl, Visual Basic, Assembly, R, Objective-C, Delphi, PL/SQL, Scratch Julia, Lisp, Clojure, Alice, Lua, Transact-SQL, Kotlin, Ada, ABAP, FoxPro, F#, VBScript, Hack, Logo, Scheme, D, COBOL, ML, Scala, Fortran, Prolog, Erlang, Crystal, Apex, SAS, Awk, Bash, Dart, LabVIEW, Rust ] ________

Sign In or Register to comment.