|
-
Jan 24th, 2006, 11:25 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Access Report Question
Hello,
I have an access report that I would like the first field to display the count of the record being dispayed starting at one. Is there a formula I can add to a field to calculate this?
Thanks
-
Jan 24th, 2006, 11:56 PM
#2
Re: Access Report Question
You can create a unbound textbox on your detail section. Create a module level integer variable. Then in the Report's Detail_Format procedure you can increment your variable in a formula like IntCount = intCount + 1.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 08:06 AM
#3
Thread Starter
Frenzied Member
Re: Access Report Question
Would I put the formula in the text box?
-
Jan 25th, 2006, 10:12 AM
#4
Re: Access Report Question
No, you put it in the class module behind the report.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 10:36 AM
#5
Thread Starter
Frenzied Member
Re: Access Report Question
Ok I created a module level variable
VB Code:
Public iIntCount As Integer
Then I added the following behind the report:
VB Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
iIntCount = iIntCount + 1
txtRank = iIntCount
End Sub
When I run the report the number it starts counting from starts @ 2388...
Do you know what would cause that?
-
Jan 25th, 2006, 11:18 AM
#6
Re: Access Report Question
On the report Report_Open event initialize the iIntCount variable to 0. See if that helps. Is that value the number of records by any chance?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 11:23 AM
#7
Thread Starter
Frenzied Member
Re: Access Report Question
 Originally Posted by RobDog888
On the report Report_Open event initialize the iIntCount variable to 0. See if that helps. Is that value the number of records by any chance?
Yeah I tried that and get the same thing.... yes it is the number of the records, would it be better to add an autonumber field to the query? I am not sure how I would do that, if you have an example...
-
Jan 25th, 2006, 11:28 AM
#8
Re: Access Report Question
An autonumber field would work if your not sorting or limiting the records in your recordsource in any way. For ex. if you had 2000 records then your id will be from 1 - 2000 sequential. But if you use a filter or where clause in your sql for your recordsource then you will get id numbers that are not sequential.
To add a autonumber field to your access table, in design view of the table add a new field and calll it idCount or ??? and select the Autonumber item from the type combo dropdown. Bind that field to your textbox txtRank.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 11:31 AM
#9
Thread Starter
Frenzied Member
Re: Access Report Question
Yeah the report had to be sorted and it is coming from a query... was wondering if you could add a autonumber field to the query as it was run, but probably not.... will have to figure out why I am getting such a high number to start on my module level variable...
-
Jan 25th, 2006, 11:35 AM
#10
Re: Access Report Question
Ok then if your doing those things to it then you can add a dynamic field on the fly but I forget how the formula may go. 
Let me see if I have any projects that used this in them.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 11:54 AM
#11
Thread Starter
Frenzied Member
Re: Access Report Question
Yeah if you could find anything I would appreciate it, Thanks man.
-
Jan 27th, 2006, 09:10 AM
#12
Thread Starter
Frenzied Member
Re: Access Report Question
Found a way to do it in the report... Had to create an unbound text boxt then go to the properts. Under Data you have to enter =1 in the Control Source property and change Running Sum to Over All. Works perfectly!
Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|