Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Continous form (Access 2000)

    I have a continous form with different rows.I want to perform a simple calculation of substraction,but it substracts only the first row.I want to substract all the rows however, since al these rows belong to one and the same order.
    For example:
    Me!branch0 = Me!Branch0 - Me!cartons
    only the first row is substracted.
    Shall i send a small example, or the problem is known to you ?

  2. #2
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Continous form (Access 2000)

    Could you supply an example? Without seeing your database (or having much experience with continuous forms) I would advise running a select query with a calculated field and linking to it, but that probably isn't the most programatically acceptable solution.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Continous form (Access 2000)

    If you are trying to do this in a textbox in the footer, you need to use <code>Sum([Branch0]) - Sum([Cartons])</code>
    Charlotte

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Continous form (Access 2000)

    I answered your question about summing in another post. I wanted to point out that your proposed formula will cause a circular reference, so be careful. Me!branch0 = Me!Branch0 - Me!cartons would create an endless loop and eventually crash, so instead, you get a circular reference error. Explain what you are trying to do so we can propose a better solution.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Continous form (Access 2000)

    Thank you for the reply.I am sending the attachment with an example of my problem. By clicking the command I want the calculation to run over all the rows and not only on the first row.My code in the command is :
    Private Sub Command20_Click()
    Me!branch0 = Me!branch0 - Me!cartons
    End Sub
    In my example :
    The third product has branch0 = 30 and cartons = 1
    The first product has branch = 10 and cartons = 1
    On clicking the command, I get the calculation only on the first row :The branch0 becomes 29 but not on the subsequent rows.They remain the same, and I want with the click to carry out the caclulations for all the rows. I have curtailed a lot in my attachment.Otherwise it is more complicated.So for example, I cannot use the simple solution to carry out the calulations on the query, I have to do them on the form.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Continous form (Access 2000)

    Your code will only act on the currently selected record (not necessarily the first one). If you want it to act on all records, you must execute an update query. For example:

    Private Sub Command20_Click()
    Dim strSQL As String
    strSQL = "UPDATE qryOrderDetails SET Branch0 = Branch0 - Cartons"
    CurrentDb.Execute strSQL, dbFailOnError
    Me.Requery
    End Sub

Posting Permissions

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