Using a Database Access97 Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Chapter 6 - VB 2005 by Schneider1 Do Loop Syntax Do While condition statement(s) Loop Condition is tested, If it is True, the loop is run. If it is False,
Advertisements

STUDENT INFORMATION SYSTEM (SIS) Course Approval Procedure.
Accessing Your Data Using Reports, Grids and Queries.
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
Access Lesson 2 Creating a Database
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Relational example using donor, contrib and drive tables Please use speaker notes for additional information!
Muffin Shop - if, calculations etc. (muffins, muffins2) Please use speaker notes for additional information!
Microsoft Access 2000 Creating Tables and Relationships.
Access Lesson 2 Creating a Database
Private Sub Close_Click() On Error GoTo Err_Close_Click DoCmd.Close Exit_Close_Click: Exit Sub Err_Close_Click: MsgBox Err.Description Resume Exit_Close_Click.
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
InvEasy (Project1) Please use speaker notes for additional information!
Break Processing Please use speaker notes for additional information!
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
Chapter 7 Code Tables. VB Code Box 7-1 Event Procedure for Compute Button Private Sub hsbExemptions_Change() txtExemptions.Text =Str(hsbExemptions.Value)
Mark Dixon Page 1 23 – Web applications: Writing data to Databases using ASP.
1/36 Database Programming with Visual Basic.Net and MS Access IKE Lab. Yunho Song Database Management and Analysis.
Let’s get started using Visual Basic!. Private Sub cmdGo_Click... Dim strMessage As String Dim sngSum As Single If IsNumeric(txtNumber1.Text) = False.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
The Repetition Process in Visual Basic. The Repetition Process The capability to repeat one or more statements as many times as necessary is what really.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics to be covered §Comparing Values in Selection Criteria §Calculating Values in a Query §Changing the appearance.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
Array - adding to array at run time Please see speaker notes for additional information!
Data files and databases. Need a control to browse to a file Standard controls for drive folder and list not much use The CommonDialogs control offers.
Chapter Six: Working With Arrays in Visual Basic.
New Project in Visual Basic Please use speaker notes for additional information!
© 1999, by Que Education and Training, Appendix A, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Random Files Please see speaker notes for additional information!
Why are Databases Better than Files? Multiple users can all use the same database, and have access to the current, up to the minute values for the data.
1 MIS309 Database Systems Introduction to Microsoft Access.
Delivery and other DO Examples Please use speaker notes for additional information!
Notes on ADO from other projects Please use speaker notes for additional information!
Two Forms Please use speaker notes for additional information!
Copyright © 2001 by Wiley. All rights reserved. Chapter 6: Using Arrays Control Arrays List Arrays Finding Items in Arrays Multiple Forms 2-Dimensional.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
VAT Calculator program Controls Properties Code Results.
Pay Example (PFirst98) Please use speaker notes for additional information!
Unbound Form Form not tied directly to any fields in the database Must use SQL to “bind” the fields 1.
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
CONTROL STATEMENTS. A conditional expression uses a comparison operator which results in true or false value. If the comparision is valid it results in.
Designing a Relational Database 13.4 Page A database should be created based on a design  Three steps Determine what information should be stored.
CS130 Visual Basic Project 4 Lecture Fall New topics in project 4 Database, file (table), records, fields. Application that contains menus, submenus,
2c – Textboxes and Buttons Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Tutorial 81 Field, Record, Data File Field - a single item of information about a person, place, or thing Record - a group of related fields that contain.
PHP with MYSQL Please use speaker notes for additional information!
Form and Graphical User Interfaces. Lesson plan More about queries More about entering data into a table Form.
Unbound data fields, find, filter etc. using Data Environment Please use speaker notes for additional information!
This is the software we will use to load our html page up to the server. You can download a copy for home if you want to.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
© Stefano Grazioli - Ask for permission for using/quoting: Source: Excel VBA Programming by John Walkenbach.
Multiple forms - SDI & MDI Please use speaker notes for additional information!
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Processing multiple files
Find, filter etc with connection to Access code internally
Please see speaker notes for additional information!
Department Array in Visual Basic
I am opeing Access 2003 in the Microsoft Office.
Adding Record To Your Database
Please use speaker notes for additional information!
Please see speaker notes for additional information!
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Using a Database Access97 Please use speaker notes for additional information!

donor.mdb

VB form

Connect contains Access so it does not have to be reset, for another database it would.

VB form

Text boxes

Output

Change Before change After change

PrDonor1.vbp The click events are programmed to move through the Recordset called datDonor as using methods as coded above.

PrDonor1.vbp Visible set to False for datDonor so the data control does not appear on the form.

PrDonor2.vbp Private Sub cmdChangeCity_Click() datDonor.Recordset.Edit datDonor.Recordset.Fields("City").Value = txtChangeCity datDonor.Recordset.Update End Sub Before After

PrDonor3.vbp

Private Sub cmdAdd_Click() datDonor.Recordset.AddNew End Sub The record is added at the end of the table, but when we next view the table it is in order by Idno because Idno is the index or primary key.

PrDonor3.vbp Idno is the index or primary key so when we view the donor table, it is in order by index or primary key.

PrDonor3.vbp I clicked the delete record button. As you can see the record is no longer on the table. Private Sub cmdDelete_Click() datDonor.Recordset.Delete End Sub

PrDonor3.vbp

PrDonor4.vbp Find Id results in the input box where the user can enter the id number of the record they want to locate.

PrDonor4.vbp I have keyed in the city that I want to find in Data To Find. When I click Find City, it will move to that record.

PrDonor4.vbp

PrDonor5.vbp

When Find City is clicked, the program looks for a match to the city entered in the city text box and displays the information from that record.

PrDonor5.vbp Dim wkFoundInd As String Private Sub cmdExit_Click() End End Sub Private Sub cmdFindCity_Click() wkFoundInd = "No " datDonor.Recordset.MoveFirst Do While wkFoundInd = "No " And Not datDonor.Recordset.EOF If UCase(datDonor.Recordset.Fields("City").Value) = UCase(txtCity) Then wkFoundInd = "Yes" txtIdno = datDonor.Recordset.Fields("Idno").Value txtName = datDonor.Recordset.Fields("Name").Value Else datDonor.Recordset.MoveNext End If Loop If wkFoundInd = "No " Then MsgBox "City entered is not on file", vbOKOnly, "Message" datDonor.Recordset.MoveFirst End If End Sub Compares the data in the city field on the database to the data keyed into txtCity. The comparison is made using upper case versions of both sides to assure maximum chance of success. I am now going to the recordset fields and getting the values to put into the text boxes.

Private Sub cmdFindId_Click() wkFoundInd = "No " datDonor.Recordset.MoveFirst Do While wkFoundInd = "No " And Not datDonor.Recordset.EOF If datDonor.Recordset.Fields("Idno").Value = txtIdno Then wkFoundInd = "Yes" txtName = datDonor.Recordset.Fields("Name").Value txtCity = datDonor.Recordset.Fields("City").Value Else datDonor.Recordset.MoveNext End If Loop If wkFoundInd = "No " Then MsgBox "Id number entered is not on file", vbOKOnly, "Message" datDonor.Recordset.MoveFirst End If End Sub PrDonor5.vbp Compares the data in the Idno field on the database to the data keyed into txtIdno. I am now going to the recordset fields and getting the values to put into the text boxes.

DAO (Data Access Objects)