Dim CaratteriDigitati As String
Dim strsql As String
CaratteriDigitati = Nz(Me!Test.Text, "")
strsql = "SELECT DISTANZE.DISTANZE_TAPPA2, DISTANZE.DISTANZE_TAPPA1,
DISTANZE.DISTANZE_KM, DESTINAZIONE.DESTINAZIONE_NOME,
DESTINAZIONE.DESTINAZIONE_INDIRIZZO, DISTANZE.IDDISTANZE" _
& " FROM DISTANZE INNER JOIN DESTINAZIONE ON
DISTANZE.DISTANZE_TAPPA2 = DESTINAZIONE.DESTINAZIONE_ID" _
& " WHERE destinazione_nome LIKE '*" & CaratteriDigitati & "*'"
Debug.Print strsql
Me!Test.RowSource = strsql
Tutto ok tranne che mi popola la combo con i valori duplicati e così
via, cosi decido di usare GROUP BY in questo modo
Dim CaratteriDigitati As String
Dim strsql As String
CaratteriDigitati = Nz(Me!Test.Text, "")
strsql = "SELECT DISTANZE.DISTANZE_TAPPA2, DISTANZE.DISTANZE_TAPPA1,
DISTANZE.DISTANZE_KM, DESTINAZIONE.DESTINAZIONE_NOME,
DESTINAZIONE.DESTINAZIONE_INDIRIZZO, DISTANZE.IDDISTANZE" _
& " FROM DISTANZE INNER JOIN DESTINAZIONE ON
DISTANZE.DISTANZE_TAPPA2 = DESTINAZIONE.DESTINAZIONE_ID" _
& " GROUP BY DESTINAZIONE.DESTINAZIONE_NOME" _
& " WHERE destinazione_nome LIKE '*" & CaratteriDigitati & "*'"
Debug.Print strsql
Me!Test.RowSource = strsql
Risultato: mi va in errore dicendomi "errore di sintassi (operatore
mancante) nell'espressione della query DESTINAZIONE.DESTINAZIONE_NOME
WHERE destinazione_nome LIKE '*9*"
Stesso discorso se provo ad ordinare i dati usando ORDER BY
Non riesco a capire il problema....
Grazie per l'aiuto
Massimo
Dim CaratteriDigitati As String
Dim strsql As String
CaratteriDigitati = Nz(Me!Test.Text, "")
strsql = "SELECT DISTANZE.DISTANZE_TAPPA2, DISTANZE.DISTANZE_TAPPA1,
DISTANZE.DISTANZE_KM, DESTINAZIONE.DESTINAZIONE_NOME,
DESTINAZIONE.DESTINAZIONE_INDIRIZZO, DISTANZE.IDDISTANZE" _
& " FROM DISTANZE INNER JOIN DESTINAZIONE ON
DISTANZE.DISTANZE_TAPPA2 = DESTINAZIONE.DESTINAZIONE_ID" _
& " WHERE destinazione_nome LIKE '*" & CaratteriDigitati & "*'"
Debug.Print strsql
Me!Test.RowSource = strsql
Tutto ok tranne che mi popola la combo con i valori duplicati e cos�
via, cosi decido di usare GROUP BY in questo modo
[...]
Tu le query le scrivi a mano? non usi la griglia QBE?
Bruno