Query - Identify & group records

  • Thread starter Thread starter zyus
  • Start date Start date
Z

zyus

I hv the following sample data

[Desc] [addfield]
black pepper chicken chicken
fried chicken chicken
sweet & sour fish -
chicken soup chicken
beef steak -

In a query is it possible to create additional field [addfield] that will
group part of data in [desc]. In my above example i want to group chicken.
 
Zyus -

You can use a parameter in a query to do this. Say your parameter was
[Enter Grouping]. Then in a new field in the query, you can have this:
AddField: =iif([Desc] like "*" & [Enter Grouping] & "*",[Enter
Grouping],"-")

When the query runs, a dialog box will come up with "Enter Grouping". You
can type in chicken or whatever, and see the results as you described.
 
yes; you will want to research the InString method - along with Left,
Right, Mid....you can either google or go into VBA in Access and use the Help
in there ....manipulating test strings can then be applied in a query as a
calculated field....
 
Or you can use a table of Group_Item with field Stock and this query --
SELECT YourTable.[Desc], IIf([Desc] Like "*" & [Stock] & "*",[Stock],"") AS
Stock_Type
FROM YourTable, Group_Item
WHERE (((YourTable.[Desc]) Like "*" & [Stock] & "*"));


--
Build a little, test a little.


Daryl S said:
Zyus -

You can use a parameter in a query to do this. Say your parameter was
[Enter Grouping]. Then in a new field in the query, you can have this:
AddField: =iif([Desc] like "*" & [Enter Grouping] & "*",[Enter
Grouping],"-")

When the query runs, a dialog box will come up with "Enter Grouping". You
can type in chicken or whatever, and see the results as you described.

--
Daryl S


zyus said:
I hv the following sample data

[Desc] [addfield]
black pepper chicken chicken
fried chicken chicken
sweet & sour fish -
chicken soup chicken
beef steak -

In a query is it possible to create additional field [addfield] that will
group part of data in [desc]. In my above example i want to group chicken.
 
Back
Top