🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.databases.ms-access
1 messages
1 total messages Started by Joe We are Borg Foster Tue, 04 Nov 1997 00:00
Re: Q: MISC questions
#47
Author: Joe We are Borg Foster
Date: Tue, 04 Nov 1997 00:00
65 lines
3302 bytes
vk@sbox.tu-graz.ac.at (Karl Voit) writes:

> Joe "We are Borg" Foster (joe@bftsi0.UUCP) wrote:

> : vk@sbox.tu-graz.ac.at (Karl Voit) writes:
> Sum.old is the SAME field as Sum only ONE line above.
> I want to enter the cost-field like
> = (sum-content - sum-contentFromOneLineAbove) * 0.8

You can use an expression based on a running sum in a report, a subquery
in the form's query, a control based on a DSum, or if anything can happen
in the form's filter or in the Where Expression passed to DoCmd.OpenForm,
can get really ugly in your form with something like this:

Function GetSumContent (ByVal PrimaryKeyVal As Variant) As Double
    If (Me.RecordsetClone.RecordCount = 0) Then Exit Function

    Dim R As Double: R = 0
    Me.RecordsetClone.MoveFirst
    Do

        If IsNull(Me.RecordsetClone![Sum-content]) Then
            ' what should happen here?
        Else
            R = (Me.RecordsetClone![Sum-content] - R) * 0.8
        End If

        If PrimaryKeyVal = Me.RecordsetClone![PrimaryKey] Then Exit Do
        Me.RecordsetClone.MoveNext
        If Me.RecordsetClone.EOF Then Exit Do
    Loop

    GetSumContent = R
End Function

> : 
> : > Problem 2:
> : > Sheet should be the number of the sheet one line above, so I just have
> : > to change it, when a new sheet is written.
> : > That should be the same problem like question 1 or is this easier?
> : 
> : When should the sheet number be incremented? I suppose you can give it a
> : default value of DMax("sheet", "calls") in the form.

> I have to type lists and each list has got a number. So I have to enter 20
> values from list 1, 33 values from list 2, 27 values from list 3, ...
> And I just don't want to enter the list number EVERY time. Just when I start
> to type a new list.

The DMax approach ought to work, or use one of the various means of
automatically copying the previous value that have been discussed here
in the past. DejaNews is your friend.

[snip]

-- 
Joe Foster <mailto:joe@bftsi0.gate.net> Spam is irrelevant. Assimilate this:
<ftp://ftp.microsoft.com/softlib/index.txt> Microsoft's master patch list
<ftp://ftp.microsoft.com/softlib/mslfiles/> MS I got yer patch right here!
<http://www.microsoft.com/kb/default.asp>   MS Knowledge Base
<http://www.dejanews.com/home_ps.shtml>     Usenet search and archival engine
<http://www.altavista.digital.com>          WWW *and* Usenet search engine
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads