473,480 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

having Trouble With Report

5 New Member
Could someone explain what I doing wrong?

I created a data base in access which contain all the employees who have cell phones.

the report gives me all the call made per employee , grouping them by employee numbers which works fine.
I'm am trying to write a looping code that wiil seperate each employee statement and email automatically only thier portion of the report. I setup up the macro to sendout, but it is sending all employees the full report.

Please help!!!!!!!!!!!!!
Jan 29 '08 #1
3 1132
JustJim
407 Recognized Expert Contributor
Could someone explain what I doing wrong?

I created a data base in access which contain all the employees who have cell phones.

the report gives me all the call made per employee , grouping them by employee numbers which works fine.
I'm am trying to write a looping code that wiil seperate each employee statement and email automatically only thier portion of the report. I setup up the macro to sendout, but it is sending all employees the full report.

Please help!!!!!!!!!!!!!
Easy on the exclamation marks there good buddy (a lot of people think that overuse of exclamation marks indicates instability, my theory is that it is the little !'s themselves that drive you nuts, the more you use, the more likely it is that you will start to wear your underwear on your head... just a thought)

Anyway, post the code you've got that sends to everybody and we'll have a look and see if we can fix it for you.

Jim
Jan 30 '08 #2
ERW2ERW
5 New Member
Thanks Jim and I promise to take it easy on the !.
Here in the code:
Sub RecordSetDemo()
'Create a Recordset containing all fields and records from the Emplyee Cellular Phone Useage table'
Dim myConnection As ADODB.Connection
Dim myRecordSet As New ADODB.Recordset
Set myConnection = CurrentProject.Connection
myRecordSet.ActiveConnection = myConnection
myRecordSet.Open "Emplyee Cellular Phone Useage", , adOpenStatic
'At this point myRecordset refers to the Emplyee Cellular Phone Useage table

myRecord.MoveFirst 'Go to first record in Emplyee Cellular Phone Useage table.

'The loop below prints the contents of the First field from each record.
While Not myRecordSet.EOF 'Top of Loop.
Debug.Print myRecordSet.Fields(1).Value
myRecordSet.MoveNext 'Move to next record in recordset
Wend 'Bottom of loop

Debug.Print "All Done!" 'This line not reached until loop is doen.

'Close and clean up.
myRecordSet.Close
Set myRecordSet = Nothing
Set myConnection = Nothing

End Sub
Jan 30 '08 #3
JustJim
407 Recognized Expert Contributor
Thanks Jim and I promise to take it easy on the !.
Here in the code:
Expand|Select|Wrap|Line Numbers
  1. Sub RecordSetDemo()
  2. 'Create a Recordset containing all fields and records from the Emplyee Cellular Phone Useage table'
  3. Dim myConnection As ADODB.Connection
  4. Dim myRecordSet As New ADODB.Recordset
  5. Set myConnection = CurrentProject.Connection
  6. myRecordSet.ActiveConnection = myConnection
  7. myRecordSet.Open "Emplyee Cellular Phone Useage", , adOpenStatic
  8. 'At this point myRecordset refers to the Emplyee Cellular Phone Useage table
  9.  
  10. myRecord.MoveFirst 'Go to first record in Emplyee Cellular Phone Useage table.
  11.  
  12. 'The loop below prints the contents of the First field from each record.
  13. While Not myRecordSet.EOF 'Top of Loop.
  14.     Debug.Print myRecordSet.Fields(1).Value
  15.     myRecordSet.MoveNext        'Move to next record in recordset
  16. Wend                        'Bottom of loop
  17.  
  18. Debug.Print "All Done!" 'This line not reached until loop is doen.
  19.  
  20. 'Close and clean up.
  21. myRecordSet.Close
  22. Set myRecordSet = Nothing
  23. Set myConnection = Nothing
  24.  
  25. End Sub
You could do some testing inside your While...Wend loop to see which records you would use (in this case Debug.Print) but the more efficient method would be to be more choosy about which records go into the recordset in the first place.

The easiest way would be to write a query to select just those records you want from the Emplyee Cellular Phone Useage table and open the record set on the query not on the whole table.

Jim
Jan 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2935
by: Gregory L. Hansen | last post by:
I can't seem to make a queue of objects, using the STL queue. I'm trying to make a little event manager, and I just want someplace to store events. The method definitions for EventManager have...
10
2012
by: Alejandro Castañaza | last post by:
Hi. I'm writing a program, and I need to send confidential data through the network, so I decided to use encryption, using the System.Security.Cryptography namespace. I'm using the sockets...
0
1439
by: raf_z | last post by:
Hi, I think i'm doing something simple, although i may be wrong. I was able to load a Crystal report file up until today, and even now, its only 1 report that's misbehaving. I'll confess that i...
0
754
by: GrandpaB | last post by:
Hi, I have an application that has data stored locally in an XML file and uses a Crystal Report. The application works great in the debugger, but when I deploy the application I get a "Load...
3
3870
by: Student at college | last post by:
Something is wrong with my report in Access. In the query for the report I have an order by clause. However, when I run the report, it comes out in a different order. Is there something else...
1
1235
by: Giordano | last post by:
I am trying to construct a report menu that will allow the user to select any combination of 3 variables from 3 combo boxes (Select Subject/SelectCategory/Date Range). There are 2 possible options...
0
3138
Screaming Eagle
by: Screaming Eagle | last post by:
Ok, so some associates and I are building a website, and I'm in charge of the design and layout. I've decided to go with a simple navigation bar on top contained in its own div. Under the navigation...
0
1567
by: gsuns82 | last post by:
Hi all, * I am working on jasper reports,I have successfully generated sample pdf report from a java program. * But i am getting problems when i tend to call that report genarating...
0
2061
by: ndedhia1 | last post by:
I am having trouble loading a property file and keep getting this error when running my shell script that loads and runs my jar files, etc: no property file loaded, using defaults......
0
7041
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6739
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...
0
6929
tracyyun
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...
0
5337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
181
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.