- Add the
Command Button
-cmdPList Properties:
Use a CommandButton
control to begin, interrupt, or end a
process. When chosen, a CommandButton
appears pushed in and so is sometimes
called a push button.
Name:
Caption:
On Click |
cmdPList
Print List
(Event Procedure)
|
|
- The Codes ...
Print data corresponding to the search data
Private Sub cmdPList_Click()
' Variables
Dim dbs As Database
' logical
Database declaration
Dim qdfTemp As QueryDef
' logical Query
declaration
Dim sqlcross As String
'
Set the Command
Button: - Print List disable
Me.CmdClose.SetFocus
If Me.cmdPList.Enabled = True Then Me.cmdPList.Enabled =
False
' delete Table Tempv
DoCmd.DeleteObject acTable, "TempV"
' create new table TempV
and copy TempV_temp to TempV
DoCmd.CopyObject , "TempV", acTable, "TempV_temp"
Set dbs = CurrentDb() '
logical Database
Uses current database KJV2002
' Create temporary append
Query ( copy corresponding data with search from table
BibleTable into table TempV.
' Sql View
sqlcross = "INSERT INTO TempV ( Book, BookTitle,
Chapter, Verse, TextData )"
sqlcross = sqlcross & " SELECT DISTINCTROW
BibleTable.Book, BibleTable.BookTitle,
BibleTable.Chapter, BibleTable.Verse,
BibleTable.TextData"
sqlcross = sqlcross & " FROM BibleTable"
sqlcross = sqlcross & " WHERE (((InStr([BibleTable]![TextData],'"
& vword & "'))<>False))"
sqlcross = sqlcross & " ORDER BY BibleTable.Book,
BibleTable.Chapter, BibleTable.Verse"
' Append Query
name "Temp_Append"
vqueryname = "Temp_Append"
Set qdfTemp = dbs.CreateQueryDef(vqueryname, sqlcross)
' Open Query created
DoCmd.OpenQuery vqueryname, acViewNormal, acEdit
' Delete Query
created
DoCmd.DeleteObject acQuery, vqueryname
' Run report name
Print_List, using Window Mode type Dialog
DoCmd.OpenReport "Print_List", acViewPreview, , ,
acDialog
End Sub |
Create New Report - Print_List
From the
KJV2002:Database dialog box displays,
Choose and Click The Tab - Reports and then click
New.
From the new dialog box - New report
displays, Select Report Wizard,
choose Table TempV , click Ok,
and form the other pages, choose and select the following
Fields (Book, BookTitle, Chapter, Verse,
Textdata) and click Finish.
New Report appears
Design, Report created after
modification
Note: This Report Proprieties
Record Source: |
SELECT
TempV.Book, TempV.BookTitle, TempV.Chapter,
TempV.Verse, TempV.TextData, TempV.ID
FROM TempV
ORDER BY TempV.ID; |
|
|