Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Query?

Status
Not open for further replies.

newbie2181

Technical User
May 27, 2003
77
GB
Hi there,
I have a database that has a table and a report. The table contains a lot of data and i need to filter some out for printing on the report. To achieve this i thought i would set up a query to run on that table and then set the query as the record source on the report. this is all fine except i am having a little trouble with the query. I need to display two types of data from the table, first is all records from the Transaction field that equal "New business" which i have got working easily. The next bit however is that i also need everything from the transaction field that equals "renewal" with policy number starting "GL56".

Can anyone give me any pointers on how to go about this?

Thanks

Dan
 
Hi

In Transaction field criteria "Renewal" in Policy Number Field criteria LIKE "GL56*"

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I'm not sure exactly how the field data is stored, but in the criteria expression for the transaction field, you can put: LIKE "renewalGL56*"

This will find everything where the transaction field starts with renewalGL56, the "*" mean anything can follow...its called a wild card.
 
Right cheers for that this is what i have in my query although this doesn't produce any records just returns nothing! Is what i've put in right?


Field Transaction type Transaction type Transaction type
Table Lancaster Lancaster Lancaster
Sort
Show Tick Tick Tick
Criter "New business" "renewal" Like "GL56*"
Or

Cheers

DAn
 
Hi

Well it will not will it, you are asking for Transaction Type to be "New Business" AND "Renewal" it cannot possibly be both at the same time

You need the second criteria set (Renewal and like) on the next line down to get an OR rather than an AND,

flip to the SQL view and you will see what I mean

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Cheers for that mate that cleared it all up for me. Think i'll stick to the SQL view from now on its a lot easier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top