Active X EXE (Out of Process Components)

Slides:



Advertisements
Similar presentations
Decision making in VBA. Current Event Occurs: When a form is opened When the focus leaves one record and moves to another Before the first or next record.
Advertisements

OOP-Creating Object-Oriented Programs
Systems Development Group Project Programming Access Forms.
Creating Object Oriented Programs Object oriented (OO) terminology Class vs. object Instantiate an object in a project Understand Class_Initialize / Terminate.
 Go to Control Panel of your System  Click on System and Security.
Muffin Shop - if, calculations etc. (muffins, muffins2) Please use speaker notes for additional information!
Savings Account using Class Modules Please use speaker notes for additional information!
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Introduction to Class Modules Please use speaker notes for additional information!
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.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Chapter 2: Creating ActiveX Code Components By นภดล กมลวิลาศเสถียร Dept. of Computer Engineering, Prince of Songkla University Source: Mastering Visual.
Break Processing Please use speaker notes for additional information!
Voiding a check/cancelling a payment already recorded in the G-L Voiding a Check.
Microsoft Access Using Visual Basic Routines. Visual Basic Datatypes Boolean Byte Currency Date Double Integer Long Object Single String Variant Hyperlink.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
VB Core II Conditional statements Exception handling Loops Arrays Debugging.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
MDI with Menu Please use speaker notes for additional information!
Arrays1 From time to time an object (a variable, a picture, a label or a command) does not serve as well as a set of objects of a similar kind addressed.
Applications Development
ADV_GISVB - IV1 Advanced GIS Objects/Interfaces Week Spring.
Chapter 7 P 1 Lists and Loops List boxes and combo boxes List box - list of items - useful for a list which does not change Combo box - list of items -
Two Forms Please use speaker notes for additional information!
1 CS105 Discussion 5 – Variables and If Announcements MP 1 due on Monday Midterm 1 on Tuesday If you need a conflict, request it NOW!!
ME 142 Engineering Computation I Using Subroutines Effectively.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined.
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.
Setting up google Adsense Account Please follow the instructions given in the slides to set up the google adsense account Please follow the instructions.
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
Gourav Atalkar Software Engineer bispsolutions.wordpress.com.
Programming with Microsoft Visual Basic th Edition
After completing this lesson, you will be able to: Open an existing presentation. Add a header and a footer. Preview a presentation. Change the page setup.
1 CS 106 Computing Fundamentals II Chapter 210 “Adding Controls to User Forms” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
31/01/ Selection If selection construct.
Mark Dixon 1 Soft051 Examination Sample Questions.
Form and Graphical User Interfaces. Lesson plan More about queries More about entering data into a table Form.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Type in: destiny.usd259.netdestiny.usd259.net Click on the library page tab.
Lecture 6 – Working with VBA Sub Procedures Dr Joanna Wyrobek 1.
Multiple forms - SDI & MDI Please use speaker notes for additional information!
Visual Basic - Break Processing
Arrays 1.
Processing multiple files
Getting Started Using the Wheelock Student Portal
File Handling.
Please use speaker notes for additional information!
Click here to see your question
Department Array in Visual Basic
Chapter (3) - Looping Questions.
Report using ADO connection
Subject selection for
Adding Record To Your Database
Exploring the Power of EPDM Tasks Working with and Developing Tasks in SolidWorks Enterprise PDM (EPDM) By: Marc Young xLM Solutions
Please use speaker notes for additional information!
CPAN 260 Relational Database Design and SQL
Please see speaker notes for additional information!
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
Sub 範例 Sub F ( X ) MsgBox(X ^ 2 ) End Function
Printing Interim Reports
Presentation transcript:

Active X EXE (Out of Process Components) Please see speaker notes for additional information! This out of processed component will print a report.

Select ActiveX EXE when creating an Out-of-Process Component Select ActiveX EXE when creating an Out-of-Process Component. The results are shown. The project that we are creating will be the process to print. This is out of process which means we will have a button on the form in another project that requires printing. This project will print while other processing is going on.

Option Explicit Private SADBI As SavAcctDBI Private SA As SavAcct Not used. Private Sub Class_Initialize() Set SADBI = New SavAcctDBI End Sub Private Sub Class_Terminate() Set SADBI = Nothing Private Sub PrintLine(vPrntLine As String) Static LineCnt As Integer Printer.Print vPrntLine LineCnt = LineCnt + 1 If LineCnt = 50 Then Printer.NewPage LineCnt = 0 End If The SavAcct Class Modules (different name because I did it at a different time) makes all of my class modules available to this project. You can see that under Project/References SavAcct Class Modules has been checked. Remember SavAcctDBI is the interface between the database and the program. Printer is an object that can have methods such as the Print method which prints a line or the NewPage method which advances to a new page.

This line continued below. Public Sub PrintAllAccounts() On Error GoTo PrintAllError With SADBI If .Count > 0 Then Dim i As Long Dim LineCnt As Integer Printer.NewPage For i = 0 To .Count - 1 Dim PrntAcct As SavAcct Set PrntAcct = .Item(i) With PrntAcct Dim AcctLine As String PrintLine vbCrLf AcctLine = .AccountNumber & " " & .Balance & " " & .IntRate PrintLine AcctLine With .Transactions Dim j As Long For j = 0 To .Count - 1 Dim objDsplyTran As Transaction Set objDsplyTran = .Item(j) With objDsplyTran Dim TranLine As String TranLine = vbTab & vbTab & .AccountNumber & " " & .TransactionNumber PrintLine TranLine End With Next j End If Next i Printer.EndDoc Exit Sub PrintAllError: MsgBox Err.Number & " " & Err.Description & " " & vbCrLf & Err.Source End Sub This line continued below. I will look at this in more detail on the next slides. & " " & .TransactionType & " " & .TransactionAmount

With SADBI If .Count > 0 Then Dim i As Long Dim LineCnt As Integer Printer.NewPage For i = 0 To .Count - 1 Dim PrntAcct As SavAcct Set PrntAcct = .Item(i) With PrntAcct Dim AcctLine As String PrintLine vbCrLf AcctLine = .AccountNumber & " " & .Balance & " " & .IntRate PrintLine AcctLine With .Transactions Dim j As Long For j = 0 To .Count - 1 Dim objDsplyTran As Transaction Set objDsplyTran = .Item(j) With objDsplyTran Dim TranLine As String TranLine = vbTab & vbTab & .AccountNumber & " " PrintLine TranLine End With Next j End If Next i Printer.EndDoc After AcctLine is set up, it is passed to the PrintLine procedure to be written. See the previous slide for the complete layout of TranLine. This report produces all of the accounts with all of the transactions under the appropriate account. vbTab is used to tab in for the transactions. etc After TranLine has been set up, it is passed to the PrintLine procedure to be written.

Make SavAcctPrnt01.exe creates and executable that can be used by other projects. SavAcct Printer Component is the result of the make executable. You can see SavAcctPrnt01.exe shown as the location. The name SavAcct Printer Componet was the result of accessing the Project Properties and setting Project Description to that name.

This is the project that I am going to execute This is the project that I am going to execute. It uses my class modules SavAcct Class Modules and it also uses my SavAcct Printer Component that was created on the previous slides. Note that it is the same form we have been using but I added a Print Accounts button.

When Print Accounts is clicked, the code in cmdPrntAccts_Click() is executed. Set to nothing first in case it all ready exists. PrintAllAccounts in the SavAcctPrnt class that was shown on previous slides.