Option Compare Database Sub test() Dim x x = "zaner: " & VratText("TableZanre", "id", "zaner") Debug.Print x End Sub Public Function VratText(xTable As String, xOrd As String, xFieldName As String) As String Dim MyDB As Database, MyTbl As Recordset, x_sql As String Dim ix As Long Dim x_BY, x_SDZ, xFul On Error GoTo Err_VText Set MyDB = CurrentDb 'DBEngine.Workspaces(0).Databases(0) x_sql = " SELECT * FROM " & xTable 'WHERE ( x=y) x_sql = x_sql & " ORDER BY " & xOrd ' *** Napln text texty Set MyTbl = MyDB.OpenRecordset(x_sql) MyTbl.MoveFirst ' Locate first record. ix = MyTbl.RecordCount Do Until MyTbl.EOF ' Begin loop. xfulltext = xfulltext & IIf(xfulltext <> "", ",", "") & CStr(MyTbl.Fields(xFieldName).Value) MyTbl.MoveNext ' Locate next record. ix = ix - 1 ' Increase index Loop ' End of loop. Exit_VText: MyTbl.Close ' Close table. MyDB.Close VratText = xfulltext Exit Function Err_VText: MsgBox Error$ VratText = "" Resume Exit_VText End Function
ms access - denormalizacia dat