Search By Criteria

M

Mr. Smiley

I am going to try and be as detaild as possible in my question.

I have a form called View Existing.

On this form I have four unbound text boxes. The first text box is called
Date. The second is called RFQ. The third is called RQN, and the fourth is
called PO.

I am trying to design this form so that if the user enters information in
any of these text boxes, then presses a command button called Get Data, a
form (called Main) will pop up displaying the Order that the criteria data
pertains to. I am sure this is something that must be done in VB behind the
GetData command buttons on click event, but I do not know how to write the
code. Somebody, please help me. Thanks.
 
K

KARL DEWEY

Create a query to be used as the record source for your Main form to use the
unbound textboxes. In the design view of the query grid, criteria row
associated with the corresponding field put --
[Forms]![View Existing]![Date]
[Forms]![View Existing]![RFQ]
[Forms]![View Existing]![RQN]
[Forms]![View Existing]![PO]

You should not be using "Date" as it is a reserved word in Access.

In the event for the command button Get Data just have it open Main form.

In this setup they must enter data in all four. To let them have the
option of not entering in some or all use the following instead --
Like [Forms]![View Existing]![Date] & "*"
Like [Forms]![View Existing]![RFQ] & "*"
Like [Forms]![View Existing]![RQN] & "*"
Like [Forms]![View Existing]![PO] & "*"
 
Top