You can use Access forms to create an interface to your reports and queries. You can add: Buttons to initiate reports and queries Combo Boxes, List.

Slides:



Advertisements
Similar presentations
Creating Custom Reports. 2 Design and create a custom report You can easily create custom reports based on a table or query. There are seven sections.
Advertisements

XP New Perspectives on Microsoft Access 2002 Tutorial 61 Microsoft Access 2002 Tutorial 6 – Creating Custom Reports.
Some Introductory Programming 1. Structured Query Language (SQL) - used for queries. - a standard database product. 2. Visual Basic for Applications -
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
VBA Modules, Functions, Variables, and Constants
Automating Tasks With Macros
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
Using Visual Basic 6.0 to Create Web-Based Database Applications
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
Using Objects and Properties
Systems Development Group Project Programming Access Forms.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Introduction To Form Builder
1 Chapter 5: Introduction To Form Builder. 2 Forms  Why Do We Use Form Builder?  Why Don’t We Use SQL Only?!
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 8: Writing Graphical User Interfaces
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Chapter 8: Writing Graphical User Interfaces Visual Basic.NET Programming: From Problem Analysis to Program Design.
Lab 01 Forms in excel Tahani ALdweesh Insert form into your project. 2. Change form’s properties. 3. Put controls on the form. 4. Change controls’
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
S511 Session 7, IU-SLIS 1 DB Implementation: MS Access Forms.
Office Management Tools II Ms Saima Gul. Office Management Tools II Ms Saima Gul.
Copyright 2002, Paradigm Publishing Inc. CHAPTER 12 BACKNEXTEND 12-1 LINKS TO OBJECTIVES Mail Merge Concepts Mail Merge Concepts Mail Merge Wizard Mail.
1 Advanced Reports Dr. Peter Wayne. 2 Here is the set we will use for the report.
® Microsoft Office 2013 Access Creating a Database.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
DB Implementation: MS Access Forms. MS Access Forms  Purpose Data entry, editing, & viewing data in tables Forms are user-friendlier to end-users than.
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
1 After completing this lesson, you will be able to: Create and run a query. Specify criteria in a query. Create a calculated field. Create a multiple-table.
1 MIS309 Database Systems Introduction to Microsoft Access.
1.
Introduction to a Database Defining a database Database window in Access The six items in window: Tables, Queries Forms, Reports, Macros, Modules.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Pasewark & Pasewark 1 Access Lesson 5 Creating and Modifying Reports Microsoft Office 2007: Introductory.
AVCE ICT – Unit 7 - Programming Session 16 – Database and VB.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
CS 281 – Fall 2015 Lab 4 Parametric Query and Forms in MS Access.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
An Introduction to Forms. The Major Steps of a MicroSoft Access Database  Tables  Queries  Forms  Macros  Reports  Modules On our road map, we are.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 5 1 Microsoft Office Access 2003 Tutorial 5 – Enhancing a Table’s Design.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
CS 281 – Fall 2010 Lab 4 Parametric Query and Forms in MS Access.
1 Chapter 6: Creating Oracle Data Block Forms. 2 Forms  Application with a graphical user interface that looks like a paper form  Used to insert, update,
Chapter 8: Writing Graphical User Interfaces
Access Creating a Database
Microsoft Access 2003 Illustrated Complete
Access Creating a Database
Excel VBA Day 3 of 3 Tom Vorves.
Microsoft Office Access 2003
Microsoft Office Access 2003
Microsoft Office Access 2003
Microsoft Office Access 2003
Presentation transcript:

You can use Access forms to create an interface to your reports and queries. You can add: Buttons to initiate reports and queries Combo Boxes, List Boxes and Option Groups to facilitate selecting criteria

Simple control panel Control panel with options Record selector

Forms appear to have been designed primarily for data entry and display, not for running reports, so the wizards aren’t very helpful in creating Control Panel type forms. Go straight to Design View

A new, blank form is about as empty as a thing can be. Use tools from the toolbox to fill it. Label Option Group Combo Box List Box Button

Behind every successful button is an Event Procedure. This is an expression, macro or Visual Basic code that is executed when you click.

Private Sub btnSuDocs_Click() Dim stDocName As String stDocName = "Circ Transactions by SuDocs" DoCmd.OpenReport stDocName, acPreview End Sub By trying the various actions in the wizard, you can learn how actions are coded in Visual Basic

Get to Visual Basic by clicking the Code icon in the toolbar.

You can start from what the wizard creates and add a bit at a time until it does what you want. We’ll look at more VB details later

Choosing Command Button from the toolbar walks you through the Command Button Wizard Buttons are good for initiating actions

Combo Boxes let you select items from a list There is a Combo Box Wizard that helps you set up the value list

The “Row Source” property of a Combo Box is a query that you can change. If you click on the ellipsis, it shows you the query and you can alter it as you wish.

List Boxes are similar in concept to Combo Boxes, but I find them more restrictive and usually use Combo Boxes, instead. List Boxes have their own wizard.

Option Groups provide groups of mutually exclusive choices. These are great for overall selections that may determine what parameters are necessary. There is a wizard for Option Groups, too.

There are several clunky ways to pass parameters from forms to queries and reports: Start the query and let it get its own parameters Make the query get data from the (open) form Private Sub Form_Close() Dim DB As Database Dim PathTBL As TableDef Dim PathRST As Recordset DeleteTable "htmlpath" Set DB = CurrentDb Set PathTBL = DB.CreateTableDef("htmlpath") PathTBL.Fields.Append PathTBL.CreateField("path", dbText) DB.TableDefs.Append PathTBL Set Pathrst = PathTBL.OpenRecordset(dbOpenTable) PathRST.AddNew PathRST![path] = Me!Text1.Value PathRST.Update PathRST.Close End Sub Save the form input to a table, and link the table into the query

Dim DB As Database Dim PatQDf As QueryDef Set DB = CurrentDb Set PatQDf = DB.QueryDefs("Patron info") PatQDf.Parameters("Barcode") = txtBarcode PatQDf.Execute You can call a query from Visual Basic after setting its “Parameters” property. 1.Declare Database and QueryDef type variables with “Dim” 2.Set the Database variable to the predefined value, “CurrentDb” 3.Set the QueryDef variable to the desired query by name from the QueryDefs collection of the Database 4.Set any needed query parameters from fields in the form with the “Parameters” property of the QueryDef 5.Then you can run your query; this one uses the “Execute” method, because it is a Make Table Query     

Visual Basic’s object-orientation means that objects (such as databases, queries, combo boxes and buttons) have properties that can be read or set and methods that can be applied. DB.QueryDefs("PO Minimal") MinQuery.Parameters("[PO Number?]") MinRecs.EOF Object properties: Object methods: DB.CreateTableDef("PO_ID Table") PPHRecs.AddNew MinRecs.Close Combinations: POIDTbl.Fields.Append DB.TableDefs.Delete

The Append method needs a field, and Createfield needs a name and a type: POTbl.Fields.Append POTbl.CreateField("PO_ID", dbText) OpenRecordset needs a mode parameter and produces a value that can be assigned to a Recordset type variable: Set BibRST = BibQry.OpenRecordset(dbOpenForwardOnly) Here the parentheses specify one member of the QueryDefs collection, which is then executed: DB.QueryDefs("ugrl,resv charge totals").Execute Some methods don’t really apply to an object, so there is a special “DoCmd” object that stands in: DoCmd.OpenReport “PO, Single Ship-To", acPreview Methods often are part of more complex code

Private Sub optChooseReport_AfterUpdate() If (optChooseReport = 1) Then cmbFISCAL_YEAR.Visible = True lblFISCAL_YEAR.Visible = True txtSTART_DATE.Visible = False txtEND_DATE.Visible = False ElseIf (optChooseReport = 2) Then cmbFISCAL_YEAR.Visible = False lblFISCAL_YEAR.Visible = False txtSTART_DATE.Visible = True txtEND_DATE.Visible = True ElseIf (optChooseReport = 3) Then cmbFISCAL_YEAR.Visible = True lblFISCAL_YEAR.Visible = True txtSTART_DATE.Visible = True txtEND_DATE.Visible = True End If End Sub Wow ‘em with interactive forms

query parameters directly to a Report that is based on the query. I have had to run a Make Table query, then base the report on the results. Normal case: report is based directly on query I have not found a way to pass Special case: report is based on table created by a Make Table query

Create a Make Table query. Create a report based on the “made table”. Create a form that accepts parameters and has a “Run” or “Go” button.

Private Sub cmdRunReport_Click() Dim DB As Database Dim BaseQry As QueryDef Set DB = CurrentDb DeleteTable DB, "Form Test Table" Set BaseQry = DB.QueryDefs("Form Test Make Table Query") BaseQry.Parameters(“Start Date:") = txtStartDate BaseQry.Parameters(“End Date:") = txtEndDate BaseQry.Execute DoCmd.OpenReport "Form Test Report", acPreview End Sub OnClick event procedure for button DeleteTable function is included in reports.mdb Variable declarations Specify the query Set query parameters from form Open the report in Preview mode Execute the Make Table query

The example had parameters from Text Boxes and used a Command Button But the principles are the same with other Form objects, such as Option Groups and Combo Boxes.

Since forms are designed mostly for data entry and display, the default properties are not usually what you want for a Control Panel