Book Shop Management System
Book Shop Management System
Book Shop Management System
Preface About Visual Basic Current System Proposed System Data Flow Diagram Database Design Form Design Source Code Hardware and Software Requirement Future Scope and Limitation
References
Preface
Computer is fast emerging as a daily need in walks of life. The knowledge of computers and programming language has become basic skill need to service in todays information based society. Every business institution and the corporate section, make a use of computer for making their operation efficient & effective.
Book distributors transaction handling is one of the complex process and it required computerized system to maintain overall transactions in a easier manner. Due to heavy demand of books in these competitive worlds, data increase so much. Books shop required up to date information about the customer who purchased books or about the suppliers from where books are purchased. The books shop requires large amount of data to record and to store, which are collected from the Book House.
mercy pf any function or procedure. The likelihood of incorrect data manipulation is high. If data is declared locally only the procedure in which the data is safer, it is very restricted. In object oriented programming, a method (the function or procedure of an object) Know what data if can manipulate them. There is no confusion about who control whom. Declaring object and enclosing method and their data in a Class achieve this. General procedures the kind use in structured programming cannot access data with an object without using the object methods which are Designed too manipulate their data. In procedural program, the order of procedure and control statement determines the program, flow of control. This implies that the programmer knows the entire flow of the program while he developed it. In program designed to capture the essence of the dynamic world, this assumption is unrealistic and cumbersome. Object oriented programming captures these logical relationship in object Determines the flow of control in objects clarify the communication along the Component of an application. Object responds to the other objects. Massages move through the system, not data. Instead of invoking a Function on some data like in conventional programming method, a message is sent to object. This is the principle of operation in windows, Visual Basic is Object oriented, i.e. revolves around ready made objects, and it is event driven, All the activity in program are triggered by one event or another. Each object also Has its own event handling procedures. The Visual Basic system knows all about this already. It knows what button is and how it work. It also knows how to handle Menus dialogue boxes, drive and directory list and much else. The programmers job is to determine where, how and when an object appears on the screen what it is to do. What is caption reads what
colors it would He end what happens, when an event occurs. The events are trapped by the Execute, when the event occurs. Because the program code run through event and as such at any point a Whole range of event might be possible, the program flow is not as fixed as in a Conventional program. Operations do not have to follow a set if sequence, and Can be easily interrupted, suspended or abandoned. The processes of program Design reflex the nature of the system. One begins by creating the screen layout, And work out words from here , adding first the code that will run in response to Specific events and then any necessary code to co-ordinate the whole program. This approach of programming is called event driven programming.
Programming terminology
The terminology that is used in Visual Basic programming are: Forms Controls Module Project Procedures Properties Methods Events
Forms
The form is the basic object used in Visual Basic application development. It is a window, initially black on which controls are placed to create the screen display. The forms size, colors type are programmable. Code can be attached to the form, which would be executed when the form is loaded, closed or when the mouse is clicked or moved on the form. A simple application may use only one form but
a complex application may use many form activated by various controls pasted on the form. Each of the form on the application is saved in the disk as separate file with an extension Form .
Controls
These are objects which can be pasted on to a form and these Controls range from simple labels, which are used to display text on the screen on Form, or picture boxes for buttons, check boxes, list and other menus, To file management utilities and spreadsheet style grids. Their properties, And event they can handle, very to suit their nature. Each control can have coed Attached to it, though not all will have. A text label or graphic image, for ex. May be There simply to improve the display, and not as the start point for any activities.
Module
Code that is attached to form is accessible form anywhere on that Form, but a program more than one form. In such a case a code attached to a form. In such case a code attached to a form is not available to the other forms. In this case, the code that is required to be made available to the other forms is written in a separate module. Modules are code segments, which are not written inside the scope of any form. They have global scope. These cannot be made visible during run time. It is like any other program code. There may be several modules in one program and each is saved as separate file. These files have an extension of BAS, because these are BASICcode modules.
Procedure
All the code in the visual basic program is written in the forms of procedure, or subroutines. Most of these procedures will be
attached to the event some controls or forms. Some of the procedures would be separately written inside the modules as global functions. All the procedures start with keyword Sub and close with the keyword End Sub.
Project
The project is a file in which all the form files(*.frm files) and the modules(*.bas files) that make up the entire application, is kept . These have an extension of * .Mac. they are called make file thus any application wil have a * . vbpfile.
Properties
Each control has a set of predefined properties, method and events that it will respond to. Properties are simply characteristics of an object or control. They are used to store data describes some particular attribute of the object such as color, size or the picture present in a control. The one property that every object must have is the Name property. This is use to refer to the object must be unique in a project. Visual Basic assign default name to control when you add them to your form, but you can alter these at design time(and you should alter them at design time)to make your code more descriptive. Note that you cant change a controls Name property at run time, and these wont appear in the properties window . Properties can be set at design time using the properties window or they can be set and reference within your Visual Basic code. Properties are reference in the form of object name. property and in some respect you can think of them like a variable. You can assign a value to a property just as you assign a value to a variable. here we assign the text string john smith to text property of the object called Text1: Text1.text= john smith
Just as with variable, properties can also be used as part of other statement: Print your name is: Text1.text
Methods
Methods are action that can be performing on an object. These are like procedures. They are written in code in the form object name. method parameters for e. forms have a move method that moves them to the procedure specified by the parameter. In this case, the top left of the form would be move screen coordinates (370,915) as Form1.move 30,915 When you referred to the property or method of an object that resides in a form other than one form which you are refereeing it , you will need to give it a fully qualified reference. These means preceding name of the object with the name of the form like this: FormName.ObjectName.property This sort of reference to an object can be extended in the case of OLE application to include the name of the project before the name of the form. If you dont supply a fully qualified reference, Visual Basic assumes that you are referring to the project and form in which you are making the reference.
Events
Events are the key to Visual Basic programming each object in the Visual Basic can be respond to a predefined set of events. These would be movement of the mouse, the pressing of the key on the keyboard or the lapsing the particular period of time. You can see which events a control can respond to by adding controls to your form
and double clicking it to bring up the code window. The procedure dropdown list box in the top right corner of the code window contains a list of all the events that a control can respond to. If you select one of the item in the list box, the first and last lines of a procedure are added to your code. This proce4dure will be triggered whenever that particular event occurs, so any code that you add to the procedure will be executed at the same time. This is how you create Visual Basic code to respond to user interaction and other events.
Current system
The book shop contains different types of books of various subjects with various quality according to the customers needs and requirement. The main thing of the book shop is to maintain lot of records for the daily transaction of the business. It is necessary for every business to maintain all records, which show the profit and loss of the business. In todays life people have very little time and many things to do. They have to manage all this unbalance workload, although every one wants to achieve all their ambitions and dreams. And the present system of managing Books is very time consuming so it is very difficult to maintain good records and fast service. The paper work is becoming very difficult to handle day by day. Currently we have to keep track of each and every thing about the book shop on the paper or in register. We have to maintain lot of registers to enter these large volumes of data. This leads to the wastage of stationary. Some disadvantages are: Manual system involves a lot of paper work, so it becomes time consuming and costly.
The chances of errors in calculation of delivery of Books are more in the current manual system. The calculation of total collection for day or month or year is very difficult.
Currently no security is provided to the large amount of data of the every book details.
It becomes very difficult to maintain details of every Book as records increases day by day.
Proposed system
While creating new software we should analyze what is the basic need of the software. Analysis is nothing but a planning of creation of software to get proper output from it. Analysis is details study of projects that you want to show in your software solving problems. The basic need of the software is to save the time of the user with the help of all useful information. And also to maintain the collection of data in your computer systematically, so that its easy to understand. The proposed system provides lot of facility to the user to store information of the Books and it provides information in quick time in a systematic manner. The processing time on the data is very fast. It provides required data quickly to the user and also in specified manner to the user. All the information of Books changes is given to the user and also the reports are also generated according to the requirement of the user. Today it is becoming very difficult to maintain record manually. This software system easily does the job of maintaining daily records as well as the transaction according to the user requirements. Some advantages are: User friendly software
Easy to record all data about the Books and its details. It saves time of the user as well as prevent paper work It provides the security to the database that is large amount of important data of the hospital. It provides more reliability for keeping information.
New Customer Purchase Order Sales Book Shop Manage ment System
Database design
Form Design
Main Form:
Sales invoice
Subject form
Book Shop Management System.
Product
Customer Details:
Source Code
Book Shop Management System.
Login Form:
Dim rs As New ADODB.Recordset Public LoginSucceeded As Boolean Dim Counter As Integer Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Unload Me End Sub Private Sub cmdOK_Click() On Error Resume Next If txtPasswd.Text = "" Then MsgBox "Enter A Password:", vbCritical txtPasswd.SetFocus Exit Sub End If 'rs.Close 'After the user_id are loaded into dbUserId close the 'Recordset for further usage rs.Open "Select User_Password from users where User_Name= '" & dcUser.Text & "'", Con, adOpenDynamic, adLockOptimistic If rs.EOF <> True Then 'If Search is found If rs(0) = txtPasswd Then DoEvents 'Check If user is Admin 'Checking : To allow Settings Menu Available only to Admin Unload Me frmMain.Show DoEvents ' Srchflag = True Exit Sub rs.Close Else
MsgBox "Invalid Password!!!" & vbCrLf & "Note : Password is same as Username", vbInformation, "Enjoy Freeware" txtPasswd.Text = "" txtPasswd.SetFocus rs.Close Exit Sub End If End If 'If Srchflag = False Then 'Display msg when search not found ' MsgBox "Invalid Password" & vbCrLf & "No Access!!!", vbCritical, "Invalid User" ' End 'End If End Sub Main Form: Dim MyForm As FRMSIZE Dim DesignX As Integer Dim DesignY As Integer Private Sub backup_Click() frmBackUp.Show 1 End Sub Private Sub CoolGreen_Click() Call select_color_type(3) sys_color = "3" End Sub Private Sub Default_Click() Call select_color_type(0) sys_color = "0" End Sub Private Sub LightBrown_Click() Call select_color_type(5) sys_color = "5" End Sub Private Sub LightViolet_Click() Call select_color_type(4) sys_color = "4" End Sub
Private Sub MacGrey_Click() Call select_color_type(1) sys_color = "1" End Sub Private Sub MDIForm_Load() Dim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors ' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution ' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width frmContainer.Show 'Display the business status UpdateInfoMsg End Sub
rsProdName.Open "Select * from Books where Book_ID = " & cmbPID & "", Con, adOpenDynamic, adLockReadOnly If rsProdName.RecordCount > 1 Then MsgBox " Database Error" Exit Sub Else txtPName = rsProdName(1) txtunits = rsProdName(7) txtRPU = rsProdName(6) End If rsProdName.Close End Sub Private Sub cmbSID_Click() Dim rsSupplierName As Recordset Set rsSupplierName = New ADODB.Recordset rsSupplierName.Open "Select * from Suppliers where SupplierID = " & cmbSID & "", Con, adOpenDynamic, adLockReadOnly If rsSupplierName.RecordCount > 1 Then MsgBox " Database Error" Exit Sub Else txtSName = rsSupplierName(1) txtSCName = rsSupplierName(2) End If rsSupplierName.Close End Sub Private Sub cmdAddList_Click() 'On Error Resume Next Dim rsMed As Recordset Dim i As Integer Dim rsProdName As New ADODB.Recordset Dim tot As Long
If MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 If MFG.TextMatrix(i, 2) = cmbPID Then MsgBox "Medicine Already Exist In The List Cannot Add Same Medicine Again.....", vbCritical + vbOKOnly Exit Sub End If Next i End If If txtAmount = "" Or txtNet = "" Or txtunits = "" Or txtRPU = "" Then MsgBox "Please Enter the relevant Fields" Exit Sub End If If Val(txtUPurchased) = 0 Then MsgBox "Quantity Cannot be Zero", vbCritical Exit Sub End If 'Remove quantity rsProdName.Open "Select * from Books where Book_ID = " & cmbPID & "", Con, adOpenStatic, adLockOptimistic tot = Val(txtunits.Text) - Val(txtUPurchased.Text) rsProdName(7) = tot txtunits.Text = rsProdName(7) rsProdName.UpdateBatch adAffectCurrent rsProdName.Close Dim row As Integer row = MFG.Rows - 1 With MFG .Rows = .Rows + 1 MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, MFG.TextMatrix(row, .FixedRows = 1 1) 2) 3) 4) 5) 6) 7) = = = = = = = txtBillID cmbPID txtPName txtUPurchased txtRPU txtdis txtNet
.RowHeight(0) = .RowHeight(1) * 1.5 SizeColumns MFG, Me MFGVALUES row = row + 1 End With Call CalcFinal Call TextClear End Sub Public Sub CalcFinal() On Error Resume Next Dim amount As Double Dim Discount As Double Dim Total As Double Dim i As Integer If MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 amount = amount + (Val(MFG.TextMatrix(i, 5)) * Val(MFG.TextMatrix(i, 4))) Discount = Discount + MFG.TextMatrix(i, 6) Total = Total + MFG.TextMatrix(i, 7) Next i End If txtgrndtot = amount txtdisgvn = Discount txtpayable = Total Debug.Print Val(amount) - Val(Discount) End Sub Public Sub TextClear() txtunits = "" txtUPurchased = "" txtdis = "0" txtAmount = "" txtNet = "" cmbPID_Click End Sub Private Sub cmdClose_Click() Unload Me End Sub
Private Sub cmdDelete_Click() Dim selectedRow As Integer Dim rsProdName As New ADODB.Recordset Dim tot As Long selectedRow = MFG.row Dim i As Integer 'Add quatity back If MFG.Rows > 2 Then For i = 1 To MFG.Rows - 2 Step 1 rsProdName.Open "Select * from Books where Book_ID = " & Val(MFG.TextMatrix(i, 2)) & "", Con, adOpenStatic, adLockOptimistic tot = Val(rsProdName(7)) + Val(MFG.TextMatrix(i, 4)) rsProdName(7) = tot 'txtunits.Text = rsProdName(7) rsProdName.UpdateBatch adAffectCurrent rsProdName.Close Next i End If If selectedRow = MFG.Rows - 1 Then MsgBox "Invalid Selection.", vbCritical Exit Sub End If If Not MFG.TextMatrix(1, 1) = "" Then MFG.RemoveItem (selectedRow) Call CalcFinal End If End Sub Private Sub cmdsave_click() If MFG.Rows = 2 Then MsgBox "Please Add Items to list before you save", vbCritical, "Error Occured" Exit Sub End If Dim flag, flag1, flag2 As Boolean flag = False
flag1 = False flag2 = False Dim rsOrderID As Recordset Dim OID As String Set rsOrderID = New ADODB.Recordset rsOrderID.Open " Select * from Purchase_Orders", Con, adOpenDynamic, adLockPessimistic
rsOrderID.AddNew rsOrderID(0) = txtBillID rsOrderID(1) = cmbSID rsOrderID(2) = DTPDate rsOrderID.Update flag = True rsOrderID.Close Dim rsMed As Recordset Set rsMed = New ADODB.Recordset Dim MID As Long Dim RQuantity As Integer Dim rsAddPatient As Recordset Set rsAddPatient = New ADODB.Recordset Dim rsStock As Recordset Set rsStock = New ADODB.Recordset Dim i As Integer rsMed.Open "SELECT * FROM Purchase_Orde_Details", Con, adOpenDynamic, adLockPessimistic For i = 1 To MFG.Rows - 2 Step 1 ' Generating Purchase Order Details ID 'MID = Functions.UID(6, "PODRDTL_") rsAddPatient.Open " Select * from Purchase_Orde_Details", Con, adOpenDynamic, adLockReadOnly If rsAddPatient.EOF = False Then While rsAddPatient.EOF = False
MID = rsAddPatient(0) + 1 rsAddPatient.MoveNext Wend End If rsAddPatient.Close With rsMed .AddNew !PurchaseOrderDetailID = MID !PurchaseOrderID = txtBillID !PurchaseProductID = MFG.TextMatrix(i, 2) !PurchaseQUANTITY = Val(MFG.TextMatrix(i, 4)) !PurchaseUnitPrice = Val(MFG.TextMatrix(i, 5)) !PurchaseDiscount = Val(MFG.TextMatrix(i, 6)) !NetValue = txtpayable .Update flag1 = True End With rsStock.Open "select * from books where Book_ID= " & MFG.TextMatrix(i, 2) & "", Con, adOpenDynamic, adLockPessimistic If rsStock.EOF = False Then rsStock(4) = rsStock(4) + Val(MFG.TextMatrix(i, 4)) rsStock.Update flag2 = True End If rsStock.Close Next rsMed.Close If flag = True And flag2 = True And flag1 = True Then MsgBox "Record Saved Succesfully !!", vbInformation, "Record Added" cmdSave.Enabled = False Else MsgBox "An Error Occured while saving to the database", vbCritical Exit Sub End If Command1.Enabled = True cmdSave.Enabled = False End Sub Private Sub cmdVProducts_Click() FrmVProducts.Show End Sub Private Sub cndew_Click()
Dim ctl As Control For Each ctl In Controls If TypeOf ctl Is TextBox Then ctl.Text = "" End If Next cmbSID.Enabled = True cmdSave.Enabled = True MFG.Clear MFG.Refresh MFG.Rows = 2 Call SetData Call BillID Call ProdDetails Call MFGVALUES End Sub Private Sub Command1_Click() 'On Error Resume Next Dim strReport As String Dim strTXT As Integer strTXT = Val(txtBillID.Text) PInvoice.DataFiles(0) = App.Path & "\BookStore.mdb" 'strReport = App.Path & "\invoice.rpt" PInvoice.ReportFileName = App.Path & "\Purchase.rpt" PInvoice.SelectionFormula = "{qryPurchases.PurchaseOrderID} = " & txtBillID.Text PInvoice.WindowState = crptMaximized PInvoice.Action = 1 ' End Sub Private Sub Form_Load() If CN.State = adStateClosed Then Main Dim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors ' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution ' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) ScaleMode = 1 ' twips 'Exit Sub ' uncomment to see how Form1 looks without resizing Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width
End Sub Public Sub SetData() Dim mbDataChanged As Boolean Dim rsSuppliers As Recordset Set rsSuppliers = New ADODB.Recordset mbDataChanged = False rsSuppliers.Open "select * from Suppliers", Con, adOpenDynamic, adLockOptimistic rsSuppliers.MoveFirst cmbSID.Clear While rsSuppliers.EOF = False cmbSID.AddItem rsSuppliers(0) rsSuppliers.MoveNext Wend rsSuppliers.Close End Sub
Product Form:
Dim MyForm As FRMSIZE Dim DesignX As Integer Dim DesignY As Integer Dim WithEvents adoPrimaryRS As Recordset Dim mbChangedByCode As Boolean
Book Shop Management System.
Private Sub cmbCID_KeyPress(KeyAscii As Integer) Dim llngRet As Long Dim lstrFind As String Dim objcb As New Class1 If KeyAscii >= 33 And KeyAscii <= 126 Then If cmbCID.SelLength = 0 Then lstrFind = cmbCID.Text & VBA.Chr(KeyAscii) Else lstrFind = Left(cmbCID.Text, cmbCID.SelStart) & VBA.Chr(KeyAscii) End If llngRet = objcb.WinCBFindString(cmbCID.hwnd, lstrFind, False) If llngRet <> -1 Then cmbCID.ListIndex = llngRet cmbCID.SelStart = Len(lstrFind) cmbCID.SelLength = Len(cmbCID.Text) - cmbCID.SelStart KeyAscii = 0 End If End If End Sub Private Sub cmbSID_KeyPress(KeyAscii As Integer) Dim llngRet As Long Dim lstrFind As String Dim objcb As New Class1 If KeyAscii >= 33 And KeyAscii <= 126 Then If cmbSID.SelLength = 0 Then lstrFind = cmbSID.Text & VBA.Chr(KeyAscii) Else lstrFind = Left(cmbSID.Text, cmbSID.SelStart) & VBA.Chr(KeyAscii) End If llngRet = objcb.WinCBFindString(cmbSID.hwnd, lstrFind, False) If llngRet <> -1 Then cmbSID.ListIndex = llngRet cmbSID.SelStart = Len(lstrFind) cmbSID.SelLength = Len(cmbSID.Text) - cmbSID.SelStart KeyAscii = 0 End If End If End Sub
Private Sub cmbSID_LostFocus() Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim SID As Long Dim Sup As String rs.Open "select * from Suppliers where CompanyName = '" & cmbSID.Text & "'", Con, adOpenKeyset, adLockPessimistic rs1.Open "select SupplierId from Suppliers", Con, adOpenKeyset, adLockPessimistic While rs1.EOF = False SID = rs1(0) + 1 rs1.MoveNext Wend rs1.Close Sup = cmbSID.Text 'While Not rs.EOF If rs.EOF = False Then Exit Sub Else rs.AddNew rs.Fields(0) = SID rs.Fields(1) = Sup rs.Update rs.Close cmbSID.Clear Dim rs2 As New ADODB.Recordset rs2.Open "select CompanyName from Suppliers", Con, adOpenDynamic, adLockOptimistic rs2.MoveFirst While rs2.EOF = False cmbSID.AddItem rs2(0) rs2.MoveNext
Wend rs2.Close End If 'Wend cmbSID.Text = Sup End Sub Private Sub cmdViewAll_Click() FrmVProducts.Show End Sub Private Sub cmbCID_LostFocus() 'dim rsSearch as New ADODB.Recordset Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim CID As Long Dim Cat As String rs.Open "select * from categories where categoryname = '" & cmbCID.Text & "'", Con, adOpenKeyset, adLockPessimistic rs1.Open "select categoryID from categories", Con, adOpenKeyset, adLockPessimistic While rs1.EOF = False CID = rs1(0) + 1 rs1.MoveNext Wend rs1.Close Cat = cmbCID.Text 'While Not rs.EOF If rs.EOF = False Then Exit Sub Else rs.AddNew rs.Fields(0) = CID rs.Fields(1) = Cat rs.Update rs.Close
cmbCID.Clear Dim rs2 As New ADODB.Recordset rs2.Open "select CategoryName from Categories", Con, adOpenDynamic, adLockOptimistic rs2.MoveFirst While rs2.EOF = False cmbCID.AddItem rs2(0) rs2.MoveNext Wend rs2.Close End If 'Wend cmbCID.Text = Cat End Sub Private Sub Combo1_Click() If txtFields(3).Text = "" Then MsgBox "Please enter money" Exit Sub End If Dim rs2 As New ADODB.Recordset Dim i As Long rs2.Open "select cur_value from MoneyChanger where currency_name = '" & Combo1.Text & "' ", Con, adOpenDynamic, adLockPessimistic i = Val(txtFields(3).Text) * rs2(0) txtFields(8).Text = i rs2.Close End Sub Private Sub Form_Load() If CN.State = adStateClosed Then Main Dim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors
' Size of Form in Pixels at design resolution DesignX = 800 DesignY = 600 RePosForm = True ' Flag for positioning Form DoResize = False ' Flag for Resize Event ' Set up the screen values Xtwips = Screen.TwipsPerPixelX Ytwips = Screen.TwipsPerPixelY Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution Xpixels = Screen.Width / Xtwips ' X Pixel Resolution ' Determine scaling factors ScaleFactorX = (Xpixels / DesignX) ScaleFactorY = (Ypixels / DesignY) ScaleMode = 1 ' twips 'Exit Sub ' uncomment to see how Form1 looks without resizing Resize_For_Resolution ScaleFactorX, ScaleFactorY, Me MyForm.Height = Me.Height ' Remember the current size MyForm.Width = Me.Width Dim rsCategories As Recordset Dim rsSuppliers As Recordset Set rsCategories = New ADODB.Recordset Set rsSuppliers = New ADODB.Recordset Set adoPrimaryRS = New Recordset adoPrimaryRS.Open "select * from Books", Con, adOpenStatic, adLockOptimistic Dim oText As TextBox 'Bind the text boxes to the data provider For Each oText In Me.txtFields On Error Resume Next Set oText.DataSource = adoPrimaryRS oText.Enabled = True oText.Locked = True Next mbDataChanged = False rsSuppliers.Open "select * from Suppliers", Con, adOpenDynamic, adLockOptimistic If rsSuppliers.EOF = False Then rsSuppliers.MoveFirst
While rsSuppliers.EOF = False cmbSID.AddItem rsSuppliers(1) rsSuppliers.MoveNext Wend End If rsCategories.Open "select * from Categories", Con, adOpenDynamic, adLockOptimistic Debug.Print rsCategories.RecordCount Debug.Print rsSuppliers.RecordCount 'If rsCategories.EOF = False Then rsCategories.MoveFirst While rsCategories.EOF = False cmbCID.AddItem rsCategories(1) rsCategories.MoveNext Wend 'End If End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If mbEditFlag Or mbAddNewFlag Then Exit Sub Select Case KeyCode Case vbKeyEscape cmdClose_Click Case vbKeyEnd cmdLast_Click Case vbKeyHome cmdFirst_Click Case vbKeyUp, vbKeyPageUp If Shift = vbCtrlMask Then cmdFirst_Click Else cmdPrevious_Click End If Case vbKeyDown, vbKeyPageDown If Shift = vbCtrlMask Then cmdLast_Click
Reports
Sale report:
Software Requirement:
This software comes under application software. So the necessary software for this is 1) An operating system. 2) Window operating system family. 3) Window 9x,(that is window 95,98,ME,etc.) 4) Window NT, 2000, 2003.
References
1) Mastering Visual Basic 6.0 in 24 Days
3) Peterson Blogwers
4) Divya Babulgaonkar