Query Criteria Based On Form's Text Boxes and Combo Boxes

hasanrazaj1

Registered User.
Local time
Today, 16:01
Joined
Jun 3, 2009
Messages
20
Hey to All
I am wondering and searching through threads since many hours about the solution of my problem. I success to find only 1 thread on this topic but in which 1 part of my problem is mentioned.

What is My Problem?
I HAVE...


...I have a query(qrySearch) which contains data from 2 tables(Accounts & Transaction).

... I have a form(SearchForm) where i put some text boxes such as(txtStartDate, txtEndDate, txtPaymentDescription, txtPaymentType(Cash or Instrument), txtSubGroup, txtAmount, e.t.c) and some combo boxes such as (cboAccountType, cboAccountName, cboAccountNumber, cboTransactionID, cboPaymentMode(Credit or Debit)).

and

Command Box(Open Query).

WHAT I WANT?
I want user can open query sub form according to his/her criteria typed in text boxes or if he/she leave the text boxes or combo boxes blank then all related records show in query sub form.

WHAT I DO?
Here is The Code Behind Search Query.

Code:
SELECT Transcation.Category, Transcation.PayDetails, Transcation.Description, Transcation.DepositAmount, Transcation.[W/DAmount], Transcation.Date, Transcation.TranID, Account.AccountName, Account.AccountNumber, Account.AccountID
FROM Account INNER JOIN Transcation ON Account.AccountID = Transcation.AccountID
WHERE ((([Description] Like "*" & [Forms]![SearchForm]![txtamountdetail] & "*" Or [Forms]![SearchForm]![txtamountdetail] Is Null)=True) AND (([Category]=[Forms]![SearchForm]![txtsubcategory] Or [Forms]![SearchForm]![txtsubcategory] Is Null)=True) 
AND (([AccountName]=[Forms]![SearchForm]![cboacname] Or [Forms]![SearchForm]![cboacname] Is Null)=True) 
AND (([AccountNumber]=[Forms]![SearchForm]![cboacno] Or [Forms]![SearchForm]![cboacno] Is Null)=True) AND (([TranID]=[Forms]![SearchForm]![cbotransno] Or [Forms]![SearchForm]![cbotransno] Is Null)=True));

But it is not working.....:(

I will appreciate for your help. Thanks.
 

Users who are viewing this thread

Back
Top Bottom