Sql join con vba

lunedì 14 gennaio 2008 - 17.41

GIANLORY Profilo | Newbie

ciao,
ho un problema seriooooooo.
devo creare un join tra molte tabelle in maniera dinamica utilizzando il vba. ho scritto già questa funzione ma non funziona (che finezza!!!) quando le tabelle sono più di 5... come faccio????AIUTOOOOO!!!!
Public Function JOIN(val() As String, chiavi() As String) As String
Dim strQuery As String
Dim i As Integer
Dim k As Integer
Dim j As Integer
Dim indice As Integer

Dim ParteOn As String

strQuery = val(0)
For i = 1 To UBound(val)
strQuery = "(" & strQuery & " INNER JOIN " & val(i) & " ON " & val(i - 1) & "." & chiavi(i - 1) & " = " & val(i) & "." & chiavi(i - 1) & ")"
Next i
JOIN = strQuery

End Function
GRAZIE A TUTTI.
LORELLA.
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5