473,414 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

ConCatenate Function using multiple criteria in Where Clause Syntax

79 64KB
I'm using an Allen Brown concatenate related records code from Allen Browne (http://allenbrowne.com/func-concat.html).

The code works fine when I have only one criterion. The code is like this:

Expand|Select|Wrap|Line Numbers
  1. =ConcatRelated("[Allergen]","[Q_Recipe_Allergen]","[recipeID]= """ & [Txt_RecipeID] & """","[ConvWTA]" & "DESC")
Where Allergen and recipeID are text fields in query Q_Recipe_Allergen.

Txt_RecipeID is the text box name. ConvWTA is a number field that data sorting is based on.

When I tried to add the second criterion RecipeVersion, I cannot get the syntax right. The closest (not working) one I can get is as below. I got error message “Error 3061: Too few parameters. Expect1.”

Expand|Select|Wrap|Line Numbers
  1. =ConcatRelated("[Allergen]","[Q_Recipe_Allergen]","[recipeID]= """ & [Txt_RecipeID] & """" & "And [RecipeVersion]=""" & [txtRecipeVer] & """","[ConvWTA]" & "DESC") 
I think I got confused with the quotation mark. What should the correct syntax be?

Thanks,
Joe
May 3 '12 #1

✓ answered by nico5038

This message indicates in general a wrong fieldname, so check the added fields to exist in the table [Q_Recipe_Allergen]

4 4703
Mihail
759 512MB
I am pretty sure that must be a better solution for you than using the ConcatRelated() function.
If you can be more specific when inform us what you are trying to do I think we can find a better approach.

Any way... try this:
Create a query (in query design view) that do the job (using multiple criteria).
Switch to SQL view.
Copy the Where clause then paste it in your function.
May 3 '12 #2
nico5038
3,080 Expert 2GB
This message indicates in general a wrong fieldname, so check the added fields to exist in the table [Q_Recipe_Allergen]
May 3 '12 #3
Joe Y
79 64KB
Nico5038:

Thanks for the advice. In process of checking file names, I realized that I forgot to include field name [RecipeVersion] in the Query [Q_Recipe_Allergen]. That's why Access could not find this parameter.

Sorry for the silly question.
May 4 '12 #4
Joe Y
79 64KB
Mihail,

What I was trying to do using ConCatenate function is explained below.

Ingredient statement and allergen warning on Food Label are accumulating result of components used in the recipe sorting by the quantity order of predominant.

In one of my forms, I have a datasheet sub-form serves as my formulation work book. It lists all ingredients and the percentage of each ingredient. Each ingredient’s legitimate ingredient statement and allergen(s) are also part of the datasheet sub-form.

When a user finalized a recipe, in my main form, there are two text boxes that should automatically list ingredient statement and allergens using the logic explained above.

Due to the lack of VBA experiences, I wasn’t able to get this done for a very long time. I tried Access’ aggregate functions, such as Dlookup, Dsum, but it won’t work in my case. Recently, I found Allen Browne’s ConCatenate function and it works just fine.

If you have better and simple way to achieve this, Please advise. It certainly will help a lot in my database.

Thanks,
Joe
May 4 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Largo SQL Tools | last post by:
Can anyone tell me if it's possible to use a Case statement in a Where clause, and if so, the proper syntax? J.R. Largo SQL Tools The Finest Collection of SQL Tools Available...
2
by: kuhni | last post by:
Hi everybody, I have a problem with my SQL-Statement: SELECT * FROM WHERE (((Year > 2003) And (Month <= 6)) Or (Year = 2003)) The WHERE-clause doesn't work properly. As result I receive...
3
by: gupta.harika | last post by:
Hi everyone, I am a developer working on php with oracle as backend. I am facing a problem related with the CLOB data. The problem is as follows My application uses a table which contains Clob...
2
by: MCOOP | last post by:
Is there a way to have a declare variable (@where) be used as the WHERE clause in a stored procedure? The reason I ask is that I'm trying to use one sql statement for several possible WHERE...
16
by: tiarynn | last post by:
Hi everyone, I am a beginning to intermediate user with Access 2000 on XP. I am trying to create a query from a table of more than 1300 records. I need to look up individuals by their SSN only...
1
by: akirekab | last post by:
I am using DCount, but I am not able to find how to set simple multiple criteria. Here is sample of what i need. =DCount("PatientProfileID","qryFaceToFaceReason_EAP_VG","FaceToFaceReasonID=2"...
2
by: dlevene | last post by:
Hi - newbie here, be gentle. In Access 2003, I've created a report (based on a query) to produce mailing labels for all records where = "Community". is a combo-box field with the values coming from...
3
by: kstevens | last post by:
Please help. I know the sysntax is wrong. Here are some details. I am looking for the sum of past shipped items. I originally wrote this Dsum with only one criteria, but because of multiple...
1
by: mbbum88 | last post by:
Hi there, I'm still relatively new to Access and am trying to build a database to track applicants for jobs. The form I'm having a problem with is one for "Editing applications". I want to use...
3
by: Vivekneo | last post by:
Hi, iam trying to insert values in the child table, with condition that both pk and fk should match, pk = stud_id and fk dstud_id. here is what iam trying include('config.php'); if...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.