			PBQuery for Microsoft Access
  			    PUSH BUTTON QUERIES
				Kirk E. Barrett

PBQuery is a module for MS-Access allowing what I believe to be the simplest method for
 a user (normally computer illiterate) to make elaborate queries on a database table simply 
by pushing buttons. This is a query screen and methed worth trying!

Uses two listboxes with an ADD/DELETE buttons for selection of items to 
query on for a given field.  And an EDIT BOX to LISTBOX for string and date type entries.  
Includes * searching, and ranges for dates.    Source listbox Data can be obtained by:
Hardcoded strings, other tables, or unique values from withing the field your searching.

GENERATES real live SQL select command lines that can be cut-and-pasted into ANY 
Access filter report or query.  Saves user-created queries as a normal Access wizard 
generated query, accessable from database window!  

Use this method for users who need to make really wild, complicated queries on every 
darn field in your database.  The code is simple and macros are short -- Enjoy!


Before ripping into this module, form and macros, please read the included 
MICROSOFT WORD 2.0 document file: LBSELECT.DOC  written by Don Shuey.  
His code on transferring strings from one listbox to another gave me the inspiration 
to create this.  YOU MUST observe all his rules when using
this - i.e. what methods, macros and functions to call from the form objects 
OnPush/OnOpen/OnClose properties.  The extra buttons and functions called can 
easily be found by viewing the properties of the buttons on the forms.  Also 
remember properties of the forms themselves!!!


Requied Objects:
	Modules:
		Push Button Queries
	Macros:
		PBQueryMacros
		PBSaveQuery
	Reports:
		PBQueryReport
	Forms:
		PBQueryForm
		PBProgress
		EditSelection
		ListSelection
	Queries:
		PBLoadReportsIntoPickListListBox
	Tables:
		PBQueryResults	*
		Video Log Table	*
	
	* = Tables are identical, PBQueryResults is structure-only copy of Video Log Table, my sample table




Functions YOU can call:

	BuildTheSQL(x)	Builds SQL Select Statement from user-created selections
		x=0 for Normal SQL Build, if all recs selected, ask user.
		x=1 for Quiet SQL Build, if all recs selected, assume thats what they want
		x=2 for Quiet SQL Build, if all recs selected, return "ABORT" as SQLCmd

	DoTheSQLQuery()	' actually do the record selection and dump results into
			 PBQueryResults table, and start a report.  (calls BuildSQL() )

	SQLTotalSelected()		For Reports, return # records matching selected

	SQLGetWhere()		strips all but WHERE portion of SQL string for submission
				to FINDFIRST criteria, and FINDNEXT critera statements when
				searching DynaSets
	
	SaveTheQuery()		Called from macro to send SQLCmd to the
				Access Query builder.  Sends into VIEW|SQL menu option dialog

	PBStatusBox(ACTION$)	Cheesy little status window telling whats going on during a build/run SQL
		ACTION$ = "ON"
		ACTION$ = "OFF"
		ACTION$ = "TEXT TO DISPLAY IN WINDOW"


	ListResetQuery()		Reset selections made by user to ""


Things you must modify for your own stuff:

	ListSelectOnClose()		' Pack your string arrays or tables with results of user-created selections.
	ListFillBox()		' Fill source listbox with default values.  Could come from table or be
				  hard coded.


This is standard Access stuff, and the reason for relaseing it is as a thank you to others whose code I've looked at
and gotten ideas and learned something from..  

A demonstration of Macros modules, reports, and queries are present in this...
...little neato way for a really computer illiterate person to make really complex queries, save, and print them.

Enjoy!

I can be reached at:
	Kirk E. Barrett
	CompuServe 	76516,3042
	America OnLine! 	KEBarrett
	MHS:		KIRK@ADSHB1  Hub #: (717) 397-9598 
