i am using access 2007 and i am trying to combine multiple rows into one. i am using the code from this site but i continue to get this error:
Compile error in query expression. last(concat(data1.company,data1.esi))
i tried using max instead of last same error however. -
Public Function Concat(strCOMPANY As String, _
-
strESI As String) As String
-
Static strLastCOMPANY As String
-
Static strESI As String
-
-
If strCOMPANY = strLastCOMPANY Then
-
strESI = strESI & ", " & strESI
-
Else
-
strLastCOMPANY = strCOMPANY
-
strESI = strESI
-
End If
-
Concat = strESI
-
End Function
-
my query is as follows -
-
SELECT data1.COMPANY, Last(Concat(data1.[COMPANY],data1.[ESI])) AS ESIs
-
FROM data1
-
GROUP BY data1.[COMPANY];
-
It looks like you've got something from Producing a List from Multiple Records but not followed the instructions very well. You should be working with Max() (and posting that code properly - NOT typing it in).
That said, I would expect, assuming the data fits the required format, that it would work.
7 1960 NeoPa 32,556
Expert Mod 16PB
It looks like you've got something from Producing a List from Multiple Records but not followed the instructions very well. You should be working with Max() (and posting that code properly - NOT typing it in).
That said, I would expect, assuming the data fits the required format, that it would work.
Thanks NeoPa. it worked perfectly.
is there anyway to do this without the use of some VBA function call? I mean, to do it entirely within an SQL statement, ... no modules, just plain SQL
Not with Jet SQL no. In DB2 and SQL Server you can use the built in XML functionality. In MySQL you can use a variable.
NeoPa 32,556
Expert Mod 16PB
It's a somewhat unnatural request to be fair Pod. SQL and RDBMSs are based on set theory, in which positioning is not relevant. Various systems nevertheless supply such functionality (as indicated by Rabbit's post).
"Various systems" always seem to be excluding Microsoft.Jet :)
The reason for my request is that I always try to put as much of the work within the SQL statement, to get as much done as possible before the rest of the code within tool takes over... but it looks like I will have to add a function ...
NeoPa 32,556
Expert Mod 16PB
Actually, Jet tends more towards providing extra towards those whose thinking is less than pure (as in pure set theory). In this case though, while it does provides the Cross-tab query, that's as far as it goes as far as I know. So, ultimately, you're still out of luck there I'm afraid.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: RotterdamStudents |
last post by:
Hello there,
i have a strange problem. I can't get php to insert multiple rows at once in
a MySQL database. I use the
$sql = "INSERT INTO database (a,b,c,d,e) VALUES ('$a', '$b' ,'$c', '$d',...
|
by: fip |
last post by:
Hi,
On DB2 7.1.2 on MVS OS 390, when I tried to do an insert with
multiple row contents in the values clause:
insert into table11 values('aaaa', 'fa'), ('bbbb', 'fb')
I got the error:
...
|
by: don.fleming |
last post by:
Hi folks: Am doing a VBA SQL Select stmt with multiple rows found and
not getting RecordCount > 1. I've verified there are multiple rows
found by copying my SQL stmt from Debug window and pasting...
|
by: manjub |
last post by:
Hi,
I am trying to add ability to delete multiple rows from a DataGridView
in my application. When user selects multiple rows and presses delete
button, I want to show a message asking to user...
|
by: BerkshireGuy |
last post by:
I was searching the threads about combing multiple rows into one and
found some good stuff, but need your help to expand on it.
I have a table as follows
Policy Number DateOfTrans TransType...
|
by: jackiefm |
last post by:
I realize the thread I am responding to was posted in January but I am basically having the same issue. I am not familiar with VBA but use Access daily. I have written simple scripts but nothing to...
|
by: boss1 |
last post by:
i have textfile containing multiple rows.Each row containing same type of strings.now my problem is i can read only one row frequently but i can't read multiple rows.
so how can i solve this...
|
by: jasone |
last post by:
Hi all,
im nearly there with this one and im sure it shouldnt be hard to solve, i just cant seem to find the solution.
ive got records being displayed, the user can then tick what records to...
|
by: Nipun Valoor |
last post by:
My query is this
select (select COUNT (*) from S_PROD_REL where PAR_PROD_ID IN (select ROW_ID from s_prod_int where S_PROD_REL.PAR_PROD_ID = S_PROD_INT.ROW_ID) AND PROD_ID IN(select ROW_ID from...
|
by: Jeremy Goodman |
last post by:
Access 2007; Merging records containing multivalue drop down lists.
I have a database showing legislation information divided by State/territory. The database needs to be able to show the info...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |