Beruflich Dokumente
Kultur Dokumente
The project entitled as COURIER MANAGEMENT SYSTEM is developed to transfer the some important and personal messages from one place to another. So this is used for global connections. Immediate processing will be done. The important notification of this project is to maintain a high level of trading. Today people like to send the letter and other things with the help of this courier. Because it is maintaining the timings and the minimum expenditures. The international and cargo trading can be done in this courier. This project is provided for making this work as computerized one. So the manual workings can be reduced by this valuable processing. This courier is also used in domestic and it is also provided in remote areas. So the person who is unknown to this process is also learned easily. The branches of this courier are provided all over the world. The courier is much faster than the postal letters, so the people like to have this kind of approaches. The project is developed using the front-end Visual Basic 6.0 and as a back-end we use MS-Access7.0, So the storage of data for different modules are easy and viewing the data can be done in the forms organized in the database.
Expenses Details: This detail is provided for the allowance of the working members, traveling charges, Vehicle Allowances are maintained in this form. According to the changes of data it can be updated.
Branch Details: The branch details are used to have the records about the branches provided in different places and in various locations. So the urgent information can be transferred very quickly by viewing the address of the courier branch. Total Turn over Details: This form contain the branch number, when we have to view the daily, monthly turnover of the courier service ,we have enter the number of the courier service and the receiving details of that branch are entered so the turnover of each and every courier services can be viewed automatically.
Visual Basic is the most popular programming language for the worlds Most popular operating system. By encapsulating the complexities of the windows Application Program Interface (API) into easily manipulated objects. Visual Basic is the first language continue when they want rapid application development for the windows environment. The ability of custom controls to easily extend the language has made VB a popular choice in an amazingly wide variety of programming tasks.
WHAT IS VB?
Visual refers to the method used to create the (GUI).Rather than writing numerous lines of code to describe the appearance and location of interface elements, Simply drag and drop rebuilt objects in to place on screen. The Basic refers to the BASIC (Beginners All Purpose Symbolic Instruction Code) language, a language used by more than any other language in the history of computing. VB is an interpreted language. goes Faster modified became the code The main advantage of an can be easily
Interpreted language is immediate response program development often instruction and immediately tested without being compiled first. This
MULTITASKING:
Multitasking means running more than one program at the same time. A VB program can run more than once, and a VB program can Run at the same time as another windows program.
FORMS AND CONTROLS:
Text box control, displays text entered at design time or which Can be changed at runtime. It is used to get text data such as name, address, Description, etc,
LABEL:
A Label is a graphical control you can use to display static text, which a user cannot change.
CHECK BOX:
IT displays a graphical x when selected symbol disappears when you click once again.
COMMAND BUTTON:
and
the
button is used
to initiate, interrupt or to
COMBO BOX:
A combo box control combines the features of a text box Control and a list box control. User can enter a information in the text portion or select an item from the list box portion of the control.
LIST BOX:
List Box
from Which the user can select one or more choices.List box occupies a fixed area In the form and it displays a fixed amount of options.
NEED OF VB:
In visual programming environment, the user is involved more often and is given a much better understanding of how an application will Actually work before the programmer begins to program. The following steps are considered while programming in the Visual basic language. 1. Define the problem to be dissolved. 2. Work with the user to determine the inputs available to solve the problem and the required outputs. 3. Determine how to user wants to enter, retrieve and input information. 4. Design the user interface using forms and controls (The user of the computer) language begins here. It includes the design of both forms and controls and their properties.
5. Test this interface by asking the user to determine if it is acceptable. Return to step 4 6. If the interface is not acceptable. 7. Write the procedures and modules for the design. Test the completed design by asking the user if it is acceptable. If not, return to step 4 and step 6 depending upon the type of design problem.
MS-ACCESS:
MS-ACCESS is a powerful database management system and The customer can create entire application that requires little or no programming. It supports GUI features and an entire programming Language. VBA(visual basic 6.0 for application) that can be used to develop application. Access is easy enough to use that, in a short time, beginners can to manage their own data. In MS-ACCESS, the database means the collection of tables that hold data. It collectively stores all other objects such as queries, forms and reports that are used to implement the database management function effectively. The MS-ACCESS database can act as a BACK-END database for Visual Basic 6.0 as a front-end tool, MS-ACCESS customer with its powerful supports the management functions. Beginners can
create his/her own database very simply some mouse clicks. MS-ACCESS database supports so many data types where a
customer can incorporate data from other applications. A database created in MS-ACCESS can be accessed through Visual Basic 6.0
using data control. Here database means a collection of related and a table means a collection of a number of records where a record means a collection of inter-related fields. It should be noted that a field in an entity is used to describe a striate. A single table can have any number of indexed fields that can be used to locate records using an expression. This helps in filtering out information according to specific criteria. In other words the saying Necessity is the need of invention hold true for MS-
ACCESS either a beginner (or) an advanced programmer can develop her own application effectively and efficiently.
WINDOWS XP Microsoft Company developed this operating system. Windows XP supports all the major software. It has many special features over the other operating system. Multi-Tasking Graphical User Interface Plug and Play MULTI-TASKING This means that you can handle more than one task at the same time i.e., more than one application can be accessed at the same time. The UNIX and Macintosh operating system also support this Multi-Tasking . But it is non-primitive. In case on Windows XP it is primitive multitasking. By which we mean that the operating system will make the application multi-tasked.
GRAPHICAL USER INTERFACE Windows XP support Graphical User Interface. Eventually this graphical user interface can only be applied on Windows. This graphical user interface is not supported in any other operating system. PLUG AND PLAY Plug and Play in a special feature in Windows XP. It gives immediate functionally to the device follows the specification of Win32 virtual machine. Plug and Play address a series of device programming issues. The other various features of Windows XP operating system. WINDOWS EXPLORER Windows Explorer is a powerful way to browse through and manages your files drives and networks connection. LONG LIFE NAMES Windows now supports long life name to make yours files easier to organize and find. MICROSOFT EXCHANGE Users Microsoft Exchange to view and work with all types of electronic communication including E-Mail and Faxes.
: : : : : : :
Dual Core 1.53 GHz Intel (ATX) Seagate 250GB Samsung 52X Samsung 14 LCD Monitor Multimedia keyboard PS/2 mouse optical mouse
SOFTWARE SPECIFICATION
: : :
2. SYSTEM ANALYSIS
System analysis is a process of gathering and interpreting facts, diagnosing problems and the information to recommend improvements on the system. It is a problem solving activity that requires intensive communication between the system users and system developers. System analysis or study is an important phase of any system development process. The system is studied to the minutest detail and analyzed. The system analyst plays the role of the interrogator and dwells deep into the working of the present system. The system is viewed as a whole and the input to the system are identified. The outputs from the organizations are traced to the various processes. System analysis is concerned with becoming aware of the problem, identifying the relevant and decisional variables, analyzing and synthesizing the various factors and determining an optional or at least a satisfactory solution or program of action. A detailed study of the process must be made by various techniques like interviews, questionnaires etc. The data collected by these sources must be scrutinized to arrive to a conclusion. The conclusion is an understanding of how the system functions. This system is called the existing system. Now the existing system is subjected to close study and problem areas are identified. The designer now functions as a problem solver and tries to sort out the difficulties that the enterprise faces. The solutions are given as proposals. The proposal is then weighed with the existing system analytically and the best one is selected. The proposal is presented to the user for an endorsement by the user. The proposal is reviewed on user request and suitable changes are made. This is loop that ends as soon as the user is satisfied with proposal.
Preliminary study is the process of gathering and interpreting facts, using the information for further studies on the system. Preliminary study is problem solving activity that requires intensive communication between the system users and system developers. It does various feasibility studies. In these studies a rough figure of the system activities can be obtained, from which the decision about the strategies to be followed for effective system study and analysis can be taken.
suggest the type of equipment, required method developing the system, of running the system once it has been designed. Technical issues raised during the investigation are: Does the existing technology sufficient for the suggested one? Can the system expand if developed? The project should be developed such that the necessary functions and performance are achieved within the constraints. The project is developed within latest technology. Through the technology may become obsolete after some period of time, due to the fact that never version of same software supports older versions, the system may still be used. So there are minimal constraints involved with this project. The system has been developed using VB the project is technically feasible for development. ECONOMIC FEASIBILITY The developing system must be justified by cost and benefit. Criteria to ensure that effort is concentrated on project, which will give best, return at the earliest. One of the factors, which affect the development of a new system, is the cost it would require. The following are some of the important financial questions asked during preliminary investigation: The costs conduct a full system investigation The cost of the hardware and software The benefits in the form of reduced costs or fewer costly errors
Since the system is developed as part of project work, there is no manual cost to spend for the proposed system. Also all the resources are already available, it give an indication of the system is economically possible for development. BEHAVIORAL FEASIBILITY This includes the following questions: Is there sufficient support for the users? Will the proposed system cause harm? The project would be beneficial because it satisfies the objectives when developed and installed. All behavioral aspects are considered carefully and conclude that the project is behaviorally feasible.
Observation:
Observation of the functioning of the existing system gives the Idea for the design of the new system. This will figure of the pitfalls of the Current system. It is helpful to understand and study the entire current system. By observation we can point out the changes needed to the existing system. It also validates the data gathered by other means. It also gives a better understanding of the work loads & pressures faced.
Interview:
The main objective of the interview is from the to gather concerned
authorities/employees to find the System requirements & there by improving the existing system. Interviewing the managerial staff & users can make a thorough understanding of the system &this will be useful to improve the efficiency of the existing system.
Discussion:
The main objective of the discussion is to transfer the ideas between the department & the system developer. Through discussions, the problem faced by the user during data entry, data retrieval, report generation can be understood.
Reports are produced by manual processing, that will be an unformatted manual and unreliable. Data security is less. Calculations are done manually. To avoid all these limitations and make the working more accurately the system needs to be computerized.
3. SYSTEM DESIGN
3.1 LOGICAL DESIGN & PHYSICAL DESIGN
The logical flow of a system and define the boundaries of a system. It includes the following steps: Review the current physical system its data flows, file content, volumes, frequencies etc Prepares output specifications that is, determines the format, content and frequency of reports Prepares input specifications format, content and most of the input functions Prepares edit, security and control specifications Specifies the implementation plan Prepares a logical design walk through of the information flow, output, input, controls and implementation plan Reviews benefits, costs, target dates and system constraints PHYSICAL DESIGN Physical system procedures the working systems by define the design specifications that tell the programmers exactly what the candidate system must do. It includes the following steps: Design the physical system Specify input and output media Design the database and specify backup procedures Design physical information flow through physical design walk through Plan system implementation the system and a
Prepare a conversion schedule and target date Determine training procedures, courses and timetable Devise a test and implementation plan and specify any new hardware/software Update benefits, costs, conversion date and system constraints DESIGN/SPECIFICATION ACTIVITIES Concept formulation Problem understanding High level requirements proposals Feasibility study Requirements engineering Architectural design
Whenever the use r enter an error data, error manager displayed user can move to next field only after entering the connect data.
4. SYSTEM DEVELOPMENT
After getting the approval of the design phase reports from the authorities the development phase activity starts. The principal activity of the overall development phase constitutes coding and testing the computer program modules of the system. The other important activity includes implementation planning, equipment acquisition and system testing. Change over all the process of dropping the existing system and implementing the new system. The conversation plan provides the procedures, program module and tables preparatory to actual change from old system to the new system.The preliminary plan for the change over includes the following activities. The necessary tables are created keeping the requirement of the new system in mind using the database The program modules to maintain the master tables and transaction processing are coded and debugged Data reports are used to generate reports and the program modules are tested in planned sequences.
5. SYSTEM IMPLEMENTATION
Implementation is the stage, which is crucial in the life cycle of the new system designed. The main stages in the implementation are Planning Training System testing Implementation means converting a new or revised system into an operational one. Conversion is the main aspect of implementation. It is the process of designing from old one to the new one. POST IMPLEMENTATION REVIEW The post implementation review is sometimes called system audit. The review is intended to accomplish two goals. 1. Evaluate the operational information system that users develop 2. Evaluate the system development procedures to determine how the project could have improved Maintain is one important phase in implementation. Maintenance describes four activities that are undertaken after a program is released for use. The first maintenance activity occurs because it is unreasonable to assume software will uncover all latent errors in a large software system. The process that includes the diagnosis and conversion is called corrective maintenance. Adaptive maintenance is an activity that modifies software to properly interface with the changing environment is both necessary and common.
The third activity is perfective maintenance, this activity is for the majority of all efforts expend on software maintenance. The forth maintenance activity occurs when software is changed to improve future maintainability or reliability.
Before applying methods to design effective test cases, a software engineer must understand the basic principles that guide software testing. All testing should be traceable to customer requirements Test should be planned long before testing begins Testing should begin In the Small and process testing In the Large Exhaustive testing is not possible To be the most effective, testing should be an independent third party. Software testing is nothing but how easily a computer program can be tested The characteristics of a good test. A good has a high probability of finding an error A good test is not redundant A good test should be test of breed TEST CASE DESIGN Any engineering product can be tested in one of the following two ways: Knowing the specified function that a product has been designed to perform, testing is conducted for each function fully and at the same time searching for error in each function. Knowing the internal working of the product, tests are conducted to ensure that an internal operation performs according to specification. The first approach is called Black Box testing and the second White-Box testing. Black-Box tests are used to determine that software
functions are operational i.e., input is properly accepted and the output is correctly produced. A Black-Box test examines some fundamental aspects of a system with little regard for the internal logical structure of the software where as White-Box test is predicted on close examination of procedural detail. WHITE-BOX TESTING (GLASS-BOX TESTING) White-Box test focus on the program control structure. Test cases are derived to ensure that all statement in the program has been executed at least once during testing and that all logical conditions have exercised. BLACK-BOX TESTING Black-Box testing focuses on the functional requirements of the software. It is not an alternative to White-Box techniques. Rather, it is complementary approach that is likely to uncover a different class of errors than White-Box methods.
Black - Box testing to finds the following types of errors. Incorrect or missing functions Interface error Error in data structures of external Performs errors and Initialization and termination error Black Box testing process is applied during stages of testing as the attention is focused on the information domain.
ADOPTING NEW TECHNOLOGIES It is a common modification for all the systems. New technologies can be adapted to our system to satisfy wide range of possibilities. ERROR HANDLING If any errors creep in during the working period, output of the system will be affected. The user may report any difficulty to the developer to rectify those errors. UPGRADIND THE SYSTEM It refers to upgrading the hardware, software to fit the new environment.
6. CONCLUSION
This project is successfully completed and works properly according to the needs this project is developed in visual basic, ms-access & crystal reports. The system maintains data consistency by avoiding manual error &sock are maintained accurately which reduces the losses that can be made due to various environment features. All the requirement regard to this problem are solved the needs specified in the problem definition are fulfilled. This project will help all end users as a user-friendly system.
8. BIBLIOGRAPHY
1. Elias M.Awad
- System analysis & Design Galgotia Publications, New Delhi. - Visual Basic 6.0 from - Visual Basic 6.0, Bpb Publications, New - Software engineering, MC GrawHill Publications,
2. Gary Cornell Ground up 3. Petersons Evageloneous Delhi. 4. Roger S. Pressman New Delhi.
FIELD NAME CUSTID NAME PER STREET PER CITY PIN CODE PER STATE PER PH NO OFF STREET OFF CITY OFF PIN CODE OFF STATE OFF PH NO E.MAIL ID BRAND NUMBER AMOUNT DATE
DATA TYPE NUMBER TEXT TEXT TEXT NUMBER TEXT NUMBER TEXT TEXT NUMBER TEXT NUMBER TEXT NUMBER CURRENCY DATE/TIME
SIZE 20 50 50 50 25 50 20 50 50 25 50 25 50 20 20 10
description Customer id Name Present street Present city Pincode Present state Present phone number Office street Office city Office pin code Office state Office phone number Email id Brand number Amount Date
TABLE NAME=NON ACOUNT HOLDER DETAILS PRIMARY KEY: NONMEMBERID Description Nonmember id From name From sreet From city From stste Phone number Br /Fr number Date
FIELD NAME NON MEMBER ID FROM NAME FROM SREET FROM CITY FROM STATE PH NO BR/FR NO DATE
DATA TYPESSSSSSSIZE TEXT 55 TEXT 50 TEXT 50 TEXT 50 TEXT 50 NUMBER 20 NUMBER 20 DATE/TIME 10
TABLE NAME=COURIER DETAILS Primary key: courier id FIELD NAME COURIER ID MEM/NM ID BR/FR NO TO NAME TO STREET TO CITY TO PIN CODE TO STATE TO PH NO DATE WEIGHT RATE DATA TYPE NUMBER TEXT TEXT TEXT TEXT TEXT NUMBER TEXT NUMBER DATE/TIME NUMBER CURRENCY SIZE 20 50 55 50 50 50 20 50 20 20 20 Description Courier id Member nonmember id BR/ FR number To name To street To city To pin code To stste To phone number Date Weight Rate
TABLE NAME=COURIER RETURN DETAILS Foreign key: courier no FIELD NAME COURIER NO RETURN DATE BRANCH NO REASON DATA TYPE NUMBER DATE/TIME TEXT TEXT SIZE 20 20 50 Description Courier number Return date Branch number Reason
TABLE NAME=EXPENCES DETAILS Primary key: expensesid FIELD NAME expensesid PETTY EXP TRAVEL EXP REPAIR EXP E DATE DATA TYPE TEXT CURRENCY CURRENCY CURRENCY DATE/TIME SIZE 10 20 20 20 20 Description expenses id Petty expenses Travel expenses Repair expenses Expenses date
FIELD NAME STAFF NO STAFF NAME STREET CITY PIN CODE STATE PH NO QUALIFICATION DESIGNATION RIGHTS SALARY
DATA TYPE TEXT TEXT TEXT TEXT NUMBER TEXT NUMBER TEXT TEXT TEXT CURRENCY
SIZE 55 50 50 50 20 50 25 50 50 55 45
Description Staff no Staff name Street City Pin code State Phone no Qualification Designation Rights Salary
TABLE NAME=BRANCH DETAILS FIELD NAME BRANCH NAME BRANCH NO BRANCH STREET BRANCH CITY PIN CODE BRANCH STATE BRANCH PH NO DATA TYPE TEXT TEXT TEXT TEXT NUMBER TEXT NUMBER SIZE 50 55 50 55 20 50 20 Description Branch name Branch number Branch street Branch city Pin code Branch state Branch phone number
TABLE NAME=TODAY TURN OVER DETAILS Foreign key: br/fr no FIELD NAME BR/FR NO EACH _OVER COURIER RECEIVED COURIER DISPATCH DATE DATA TYPE TEXT CURRENCY NUMBER CURRENCY DATE/TIME SIZE 55 45 20 25 Description br/fr no Each day turn over Courier received Courier dispatch Date
Option Explicit Public conn As ADODB.Connection Public rs As ADODB.Recordset Sub connect() Set conn = New ADODB.Connection conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Courier.mdb;Persist Security Info=False" Set rs = New ADODB.Recordset rs.ActiveConnection = conn rs.CursorLocation = adUseClient rs.CursorType = adOpenDynamic rs.LockType = adLockOptimistic rs.Source = "SELECT * FROM dispatch" rs.Open End Sub Sub main() connect frmMain.Show End Sub
frmlogin Private Sub txtlogin_Change() If txtuname.Text = "" Then if txtuname.text= rs(0) and txtpwd.text =rs(1) then Mainrm.Show Else msgbox(MISMATCH OR INCORRECT PLS CHECK) End If End If End Sub Private Sub txtcancel_click() end End sub
formempadd Private Sub Form_Load() Set DataGrid1.DataSource = rs End Sub Sub stat() StatusBar1.Panels(1).Text = "Record " & rs.AbsolutePosition & " of " & rs.RecordCount End Sub Private Sub mnuAdd_Click() frmAdd.Show End Sub
Private Sub cmdSave_Click() If txtid.Text = "" Or txtFn.Text = "" Or txtMi.Text = "" Or txtLn.Text = "" Then MsgBox "Some fields are still empty!", vbExclamation, "Input Error" Else rs.AddNew rs("studId") = txtid.Text rs("FirstName") = txtFn.Text rs("MI") = txtMi.Text rs("LastName") = txtLn.Text rs.Update MsgBox "Record Added Successfusly!", vbInformation, "Add Record" Call clear End If End Sub Sub clear() txtid.Text = "" txtFn.Text = "" txtMi.Text = "" txtLn.Text = "" txtFn.SetFocus End Sub Private Sub txtSearch_Change() If txtSearch.Text = "" Then Call Form_Load Me.Show Else rs.Filter = "FirstName LIKE '" & Me.txtSearch.Text & "*'" Set DataGrid1.DataSource = rs End If End Sub Private Sub cmdDelete_Click() On Error Resume Next
If MsgBox("Data is not recoverable!", vbExclamation + vbOKCancel, "Confirm Delete") = vbOK Then rs.Delete End If End Sub Private Sub cmdFirst_Click() rs.MoveFirst Call stat End Sub Private Sub cmdLast_Click() rs.MoveLast Call stat End Sub Private Sub cmdNext_Click() If rs.EOF = True Then rs.MoveFirst Call stat Else rs.MoveNext Call stat End If End Sub Private Sub cmdPrevious_Click() If rs.BOF = True Then rs.MoveLast Call stat Else rs.MovePrevious Call stat End If
End Sub Private Sub Command1_Click() rs.Filter = adFilterNone rs.Requery End Sub Private Sub Command2_Click() If MsgBox("Close Applect?", vbQuestion + vbYesNo, "Confirm") = vbYes Then End End If End Sub
FrmPayroll Private Sub Form_Load() Set DataGrid1.DataSource = rs End Sub Sub stat() StatusBar1.Panels(1).Text = "Record " & rs.AbsolutePosition & " of " & rs.RecordCount End Sub Private Sub mnuAdd_Click() frmAdd.Show End Sub Private Sub cmdSave_Click() If txtid.Text = "" Or txtFn.Text = "" Or txtMi.Text = "" Or txtLn.Text = "" Then MsgBox "Some fields are still empty!", vbExclamation, "Input Error"
Else rs.AddNew rs("studId") = txtid.Text rs("FirstName") = txtFn.Text rs("MI") = txtMi.Text rs("LastName") = txtLn.Text rs.Update MsgBox "Record Added Successfusly!", vbInformation, "Add Record" Call clear End If End Sub Sub clear() txtid.Text = "" txtFn.Text = "" txtMi.Text = "" txtLn.Text = "" txtFn.SetFocus End Sub
Frmlogin
Private Sub Command1_Click() Dim objCon As ADODB.Connection Dim objCom As ADODB.Command Dim objPara As ADODB.Parameter Dim objpara2 As ADODB.Parameter Dim objRS As ADODB.Recordset Dim k As Integer
Set objCon = New ADODB.Connection Set objCom = New ADODB.Command 'Creating the DB connection string 'Please change the below connection string as per your server and database being used. objCon.ConnectionString = "PROVIDER=SQLOLEDB.1;PASSWORD=;PERSIST SECURITY INFO=TRUE;USER ID=sa;INITIAL CATALOG=TestSQL;DATA SOURCE=Rockets" 'Opening the connection objCon.Open objCon.ConnectionString MsgBox "Connection opened" 'assigning the command object parameters With objCom .CommandText = "GetRecords" 'Name of the stored procedure .CommandType = adCmdStoredProc 'Type : stored procedure .ActiveConnection = objCon.ConnectionString End With 'Create 2 output parameters Set objPara = objCom.CreateParameter("rows", adInteger, adParamOutput) Set objpara2 = objCom.CreateParameter("Status", adVarChar, adParamOutput, 50)
'Append the output parameters to command object objCom.Parameters.Append objPara objCom.Parameters.Append objpara2 'Store the result in a recordset Set objRS = objCom.Execute
'Open the recordset Do While Not objRS.EOF For k = 0 To objRS.Fields.Count - 1 Debug.Print objRS(k).Name & ": " & objRS(k).Value Next Debug.Print "_____" objRS.MoveNext Loop 'Close the recordset objRS.Close 'retrieve the output parameters values MsgBox "Total records returned: " & objPara.Value MsgBox objpara2.Value 'close connection objCon.Close 'cleaning up
Set objCom = Nothing Set objCon = Nothing Set objPara = Nothing Set objpara2 = Nothing Set objRS = Nothing End Sub FrfmReport
Dim pAdoCon As ADODB.Connection Dim pAdors As ADODB.Recordset '++ FDOADOConnection object Dim pFdoCon As IFDOToADOConnection Set pFdoCon = New FdoAdoConnection '++ Create a NEW ADO Connection object from the workspace Set pAdoCon = pFdoCon.CreateADOConnection(pWkspace) '++ Crystal Report Objects Dim pProj As CRAXDRT.Application Dim pReport As CRAXDRT.Report Set pProj = New CRAXDRT.Application Set pReport = pProj.NewReport '++ Create and open a recordset Dim SQLStr As String SQLStr = "select STATE_NAME, STATE_FIPS, SUB_REGION from gdb.us_states " Set pAdors = New ADODB.Recordset '++ Uncomment the next line if working with VB and an Access workspace '++ pAdors.cursorlocation = adUseClient pAdors.Open SQLStr, pAdoCon, adOpenForwardOnly, adLockOptimistic
'++ The pLocation parameter is set to an empty string '++ The pConnectInfo parameter is set to the ADO recordset '++ The pDLLName parameter is set to the Crystal Active Data Driver (P2smon.dll) pReport.Database.Tables.Add "", , pAdors, , "p2smon.dll" pReport.LeftMargin = 2500 '++ AddDetail - adds detail to the report Call AddDetail(pReport) '++ Send to (default) printer, don't prompt user pReport.PrintOut False, 1, , 1 pAdors.Close Set pAdors = Nothing pAdoCon.Close Set pAdoCon = Nothing Exit Sub Report_fail: MsgBox "ADO_report module : " & Err.Number, Err.Description, vbInformation End Sub Private Sub AddDetail(pRpt As Report) '++ AddDetail: Formats the report On Error GoTo Detail_fail: '++ Create the line/text/field objects for report Dim ln1Obj As LineObject Dim ln2obj As LineObject Dim ln3Obj As LineObject Dim ln4Obj As LineObject Dim ln5Obj As LineObject Dim ln6Obj As LineObject Dim txt1Obj As TextObject Dim txt2Obj As TextObject Dim txt3Obj As TextObject
Dim fld1Obj As FieldObject Dim fld2Obj As FieldObject Dim fld3Obj As FieldObject pRpt.ReportTitle = "ADO / Crystal Reports Sample" '++ Report header section With pRpt.Sections(1) .AddSpecialVarFieldObject crSVTReportTitle, 2300, 100 End With '++ Page header section With pRpt.Sections(2) Set txt1Obj = .AddTextObject("State Name", 0, 420) txt1Obj.Font.Bold = True txt1Obj.Font.Size = 9 Set txt2Obj = .AddTextObject("Sub Region Code", 2500, 420) txt2Obj.Font.Bold = True txt2Obj.Font.Size = 9 Set txt3Obj = .AddTextObject("State Fips Code", 5000, 420) txt3Obj.Font.Bold = True txt3Obj.Font.Size = 9 End With '++ Details section With pRpt.Sections(3) '++ Add three field objects to report '++ Table data source is always called "ado" Set fld1Obj = .AddFieldObject("{ado.STATE_NAME}", 500, 0) Set fld2Obj = .AddFieldObject("{ado.SUB_REGION}", 3000, 0) Set fld2Obj = .AddFieldObject("{ado.SUB_REGION}", 5500, 0) '++ Add some lines for clarity Set ln1Obj = .AddLineObject(2500, 0, 2500, 10) ln1Obj.LineThickness = 2 ln1Obj.ExtendToBottomOfSection = True Set ln2obj = .AddLineObject(5000, 0, 5000, 10) ln2obj.LineThickness = 2 ln2obj.ExtendToBottomOfSection = True Set ln3Obj = .AddLineObject(0, 10, 6500, 10)
ln3Obj.LineThickness = 2 Set ln5Obj = .AddLineObject(0, 0, 0, 10) ln5Obj.LineThickness = 2 ln5Obj.ExtendToBottomOfSection = True Set ln6Obj = .AddLineObject(6500, 0, 6500, 10) ln6Obj.LineThickness = 2 ln6Obj.ExtendToBottomOfSection = True End With '++ Report footer section With pRpt.Sections.Item(4) Set ln4Obj = .AddLineObject(0, 0, 6500, 0) ln4Obj.LineThickness = 2 End With '++ Page footer section With pRpt.Sections.Item(5) .AddSpecialVarFieldObject crSVTDataDate, 30, 0 .AddSpecialVarFieldObject crSVTDataTime, 10, 200 End With Exit Sub Detail_fail: MsgBox End Sub "AddDetailObjects :" & Err.Number, Err.Description, vbInformation