If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Query - Identify & group records
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. |
#2
|
|||
|
|||
Query - Identify & group records
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" wrote: 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. |
#3
|
|||
|
|||
Query - Identify & group records
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.... "zyus" wrote: 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. |
#4
|
|||
|
|||
Query - Identify & group records
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" wrote: 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" wrote: 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. |
Thread Tools | |
Display Modes | |
|
|