This is an old revision of the document!
Download udf_concatws.bas (V-1.0.0)
Diese Funktion verbindet Mehrere Elemente zu einem String. Das Trennzeichen kann mitgegeben werden. Sie ist sehr gut in SQL geeignet um aus mehreren Feldern ein Key zu erstellen
Public Function concat_ws( _ ByVal iDelemiter As Variant, _ ParamArray items() As Variant _ ) As String
Es wird ein String zurückgegeben
?concat_ws("-", "a", 3, "foo", "bar") a-3-foo-bar
SELECT t.id, CONCAT_WS('#', t.entity, t.portfolio, t.account) AS KEY FROM booking AS t
Attribute VB_Name = "udf_concatWs" '------------------------------------------------------------------------------- 'File : udf_concatWs.bas ' Copyright mpl by ERB software ' All rights reserved ' http://wiki.yaslaw.info/dokuwiki/doku.php/vba/functions/concat_ws 'Environment : VBA 2010 + 'Version : 1.0 'Name : list 'Author : Stefan Erb (ERS) 'History : 27.02.2014 - ERS - Creation '------------------------------------------------------------------------------- Option Explicit '/** ' * Fügt mehrere Elemente mit einem Trennstring zu einem String zusammen ' * @param Variant Delemiter ' * @param ParamArray Die verschiedenen Elemente ' * @return String ' */ Public Function concatWs( _ ByVal iDelemiter As Variant, _ ParamArray items() As Variant _ ) As String concatWs = Join(items, CStr(iDelemiter)) End Function