Results 1 to 9 of 9
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    Dsum on a form based from a query to create a opening balance

    Hi All



    I hope this is the correct place for me to post this, sorry if it's not.

    i have been modifying the access business ledger template and everything is fine, except i cant work out how to put a opening balance amount onto the the report called "Bank Account detailed transactions"

    this form is created from the query transactions extended.

    the dates to select the transactions from are selected from the form called bank account balances here you can also select which bank account you want to view.

    everything works really well, but i can't figure out how to place a opening balance at the top of the report, i currently have this as an unbound text box with the following code in

    =DSum("Actual Amount","transactions Extended","Entry Date <= #" & [Forms]![Bank Account Balances]![Start Date Txt Box] & "#")

    but i get the#ERROR message when the form opens.


    i was hoping that this would sum the value of the "Actual Amount" upto the day before the start date requested and show this in the text box

    i have attached the database, if anyone could give me some pointers, that would be awesome.

    many thanks

    steve
    Attached Files Attached Files

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Your query has this criteria for date
    Between [Forms]![Bank Account Balances]![Start Date Txt Box] And [Forms]![Bank Account Balances]![End Date Txt Box]
    Hence, the query result does not include transactions before [Forms]![Bank Account Balances]![Start Date Txt Box]
    Hence, the Dsum will not show any value. Further, the #Error may be due to spaces in criteria. Experts advise against use of spaces in field names too. (Actual Amount)
    =DSum("Actual Amount","transactions Extended","Entry Date <= #" & [Forms]![Bank Account Balances]![Start Date Txt Box] & "#")
    Try DSum("Actual Amount","transactions Extended","Entry Date<=#" & [Forms]![Bank Account Balances]![Start Date Txt Box] & "#")

  3. #3
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Amrut

    Thanks for the reply, I have tried DSum("Actual Amount","transactions Extended","Entry Date<=#" & [Forms]![Bank Account Balances]![Start Date Txt Box] & "#") as suggested but still get the #Error

    Steve

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    This works =Nz(DSum("ActualAmount","transactions Extended","[Entry Date]<=#" & Format([Forms]![Bank Account Balances]![Start Date Txt Box],"mm\/dd\/yyyy") & "#"),0)
    after I removed the date criteria in the query and space between Actual Amount. Use the "Where" condition to open the report so that only transactions matching date criteria is included.
    Hope this helps.

  5. #5
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Amrut

    many thanks for this, not getting the error now, but it's not summing the values for the previous month, the opening balance is always 0

    if you set the start date to 01-04-13 and the end date to 04-04-13 amount shown for this month is £25
    the opening balance is showing 0

    there are transactions in march but it's not summing these, not sure what to put into the where condition, sorry to be a pain but i'm new to access and this is a large learning curve for me.

    Steve

  6. #6
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Your query has this criteria for date
    Between [Forms]![Bank Account Balances]![Start Date Txt Box] And [Forms]![Bank Account Balances]![End Date Txt Box]
    Hence, the query result does not include transactions before [Forms]![Bank Account Balances]![Start Date Txt Box]
    To check your Dsum, remove the date criteria in the query and then open the report. the opening balance of 245 shows up

  7. #7
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Amrut

    many thanks for your help, i put this into the where condition of the search button in vba and it appears to be working

    Private Sub Search_Button_Click()


    Dim strWhere As String
    If Not IsNull(Me.Start_Date_Txt_Box) And Not IsNull(Me.End_Date_Txt_Box) Then
    strWhere = "[Entry Date] Between #" & Format(Me.Start_Date_Txt_Box, _
    "mm\/dd\/yyyy") & "# And #" & Format(Me.End_Date_Txt_Box, _
    "mm\/dd\/yyyy") & "#"
    ElseIf Not IsNull(Me.Start_Date_Txt_Box) Then
    strWhere = "[Entry Date] = #" & Format(Me.Start_Date_Txt_Box, _
    "mm\/dd\/yyyy") & "#"
    Else
    MsgBox "Please fill in either start and end date or specific date"
    Exit Sub
    End If
    DoCmd.OpenReport ReportName:="Bank Account Detailed transaction List", View:=acViewPreview, _
    WhereCondition:=strWhere






    End Sub

    once again many thanks for your help

    Steve

  8. #8
    bukhari is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Posts
    2
    HI,

    can u pls send me email of your solved database. so i can use the commands in my db. thanks

  9. #9
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Bukhari

    i can't send you my database is it's not mine to give you, but if you use the attached database in the first post and use the code in subsiquent posts, you should be able to achive what you are looking for

    Steve

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 03-27-2013, 05:10 PM
  2. opening balance
    By bazahara in forum Access
    Replies: 1
    Last Post: 02-19-2012, 11:37 PM
  3. Ledger Report with opening balance
    By Mahavir in forum Access
    Replies: 7
    Last Post: 01-10-2012, 03:40 AM
  4. Opening balance
    By dref in forum Forms
    Replies: 0
    Last Post: 09-20-2011, 06:24 AM
  5. Replies: 0
    Last Post: 02-15-2009, 09:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums