how to exit user entry and continue query ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a single query constructed such that I have a number of separate
SELECT statements that prompt the user for input, and each of these is joined
by UNION statements. Essentially, I allow the user to enter up to 24 dates
in which to search my table/data.

What i'm trying to figure out is how to EXIT the "user input" stage if the
user doesn't need to enter any more dates, but I still want the query to run
using the data input up to that point.

Ideas ?
 
Hi.

Wouldn't it be easier to create a query that contains all of the columns and
records that need to be seached for, then use the Form Wizard to
automatically create a form which uses this query as a Record Source, then
allow the user to "Search" for as many criteria as the user wants by using
the "Filter By Form" feature?

The user selects the date from the combo box on the form, then selects the
"Or" tab on the bottom of the form, then selects the next date from the combo
box on the form, then selects the "Or" tab on the bottom of the form, et
cetera . . . until the user is satisfied that enough dates have been chosen,
and then selects the "Apply Filter" button on the toolbar. All the records
that meet the selected date criteria will be displayed in the filtered form.
In the form's OnOpen( ) event, try:

Private Sub Form_Open(Cancel As Integer)

On Error GoTo ErrHandler

RunCommand acCmdFilterByForm

Exit Sub

ErrHandler:

MsgBox "Error in Form_Open( ) in " & vbCrLf & _
Me.Name & " form." & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description

Err.Clear

End Sub

.. . . and let the user do the date selections.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Back
Top