Heya.
I'm having a problem with a specific Report Routine in Access 2003. I've browsed the forums for advice but I'm still not able to identify why I'm getting this error.
Here is the Sub code: -
Dim rs As Recordset, month, rank, control, partner, strSQL
-
'Retrieve current month's top 5 Point Partners
-
'this recordset retrieves two fields, (0) Partner Name and (1) Total Points
-
Set rs = CurrentDb.OpenRecordset("qryTop5")
-
rs.MoveFirst
-
'If query operation was succesful, format report controls
-
If Not rs.EOF Then
-
'Retrieve Total Points for last month's Top5 partners for previous 12 months
-
For month = 1 To 12 Step 1
-
For rank = 1 To 5 Step 1
-
'Define which label's caption should be modified according to Month and Rank
-
If month > 9 Then
-
control = "lblParceirosP" & rank & month
-
Else
-
control = "lblParceirosP" & rank & "0" & month
-
End If
-
'Query only includes Top5 partners' points for last month
-
'the previous months' points are calculated by DSum
-
If month = 1 Then
-
'Check for the possibility of having less than 5 partners for last month
-
If rs.EOF Then Exit For
-
Report_rptMensalMIS.Controls("lblParceiro" & rank).Caption = rs(0).Value
-
Report_rptMensalMIS.Controls(control).Caption = Format(rs(1).Value / 1000, "##,##0")
-
rs.MoveNext
-
'Calculate partner's points for previous months
-
Else
-
'Define which partner corresponds to the current Rank
-
partner = Report_rptMensalMIS.Controls("lblParceiro" & rank).Caption
-
'Error occurs here
-
Report_rptMensalMIS.Controls(control).Caption = Format(DSum("[TOTAL POINTS]", "tblTROCAS", "[Partner Name] = '" & partner & "' AND [DATA DO RELATORIO] = #" & CStr(Format(DateAdd("m", -month, Date), "mm/""01""/yyyy")) & "#") / 1000, "##,##0")
-
End If
-
Next rank
-
Next month
-
End If
-
End Sub
-
As commented above, error occurs at line 29.
Can anyone shed some light on this, please?
Thanks in advance,
Matt
2 2437
Test your DSUM() logic to ensure that your criteria is producing a valid product. It's possible you are returning a null which in turn could be the problem.
Hi JKing, thanks for your reply.
I had already tried debugging the code function by function, it all worked out up to DSum, hence the whole confusion.
Oddly enough, I turned off my PC on friday, went home, and sure as the sun shall rise the report was fully functional by monday morning, all on its own.
Thanks for your advice though, wish I could tell you what the solution was but I guess I'll leave that up to Microsoft's Reboot Factor.
-Matt
Sign in to post your reply or Sign up for a free account.
Similar topics
by: leroybt.rm |
last post by:
Can someone tell me how to run a script from a interactive shell
I type the following:
>>>python filename
>>>python filename.py
>>>run filename
>>>run filename.py
>>>/run filename
>>>/run...
|
by: Ed |
last post by:
Hello,
I took a course in asp about 2 years ago and I was
practicing with IIS 5.0. Then I put it down for a while.
Now trying to get back to it. I can't run asp files from
subdirectories of...
|
by: orekin |
last post by:
Hi There
I have been trying to come to grips with Application.Run(),
Application.Exit() and the Message Pump and I would really appreciate
some feedback on the following questions .. There are...
|
by: Bob Day |
last post by:
Using vs2003, vb.net
I start a thread, giving it a name before start. Code snippet:
'give each thread a unique name (for later identification)
Trunk_Thread.Name = "Trunk_0_Thread"
' allow...
|
by: Bryan |
last post by:
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight...
|
by: Brett Wesoloski |
last post by:
I am new to VS2005.
I changed my program.cs file to be a different form I am working on. But
when I go to run the application it still brings up the form that was
originally declared as new. ...
|
by: Lee Crabtree |
last post by:
I remember when I was first getting into .NET Forms programming that
there was a rather emphatic rule about not constructing a form before
calling Application.Run with it. So this:
...
|
by: David Thielen |
last post by:
Hi;
In our setup program how do I determine if I need to run "aspnet_regiis –i"
and if so, is there an API I can calll rather than finding that program on
the user's disk and calling it?
--...
|
by: traceable1 |
last post by:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!
|
by: mxdevit |
last post by:
Task: run application from ASP.NET
for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |