Sofhy
XLDnaute Occasionnel
Bonjour à tous,
J'ai un code vba, qui envoie une requête à Microsoft query.
Je vous mets l'extrait qui bloque :
Sauf que c'est trop long... le tout est en rouge.
Même en utilisant l'enregistreur de macro, ça ne fonctionne pas. Déjà il ne me rapporte pas tout le texte de la requête Sql.
Je n'arrive pas à découper le texte. J'ai essayé avec " & _ " mais ça ne fonctionne pas.
Auriez-vous une petite idée ?
Merci par avance,
Sofhy
J'ai un code vba, qui envoie une requête à Microsoft query.
Je vous mets l'extrait qui bloque :
Code:
Sub Mon_Sql
Dim Sql as String
Sql = "SELECT tgApunteContab.Emp, tgApunteContabCab.Almacen, tgApunteContab.ContadorValor, tgApunteContab.ContadorCodigo, tgApunteContab.Diario, tgApunteContab.GrupoCont, tgApunteContab.Peso, tgApunteContab.Cta, tgApunteContabCab.Taller, tgApunteContab.CtaOrigen, tgApunteContab.DH, tgApunteContab.Importe, tgApunteContabCab.FechaContab, tgApunteContab.ContadorValor
FROM IcarDMS.dbo.tgApunteContab tgApunteContab, IcarDMS.dbo.tgApunteContabCab tgApunteContabCab
WHERE tgApunteContab.Emp = tgApunteContabCab.Emp AND tgApunteContab.Origen = tgApunteContabCab.Origen AND tgApunteContab.ContadorAno = tgApunteContabCab.ContadorAno AND tgApunteContab.ContadorCodigo = tgApunteContabCab.ContadorCodigo AND tgApunteContab.ContadorValor = tgApunteContabCab.ContadorValor AND ((tgApunteContabCab.FechaContab>={ts '2010-01-01 00:00:00'} And tgApunteContabCab.FechaContab<={ts '2010-01-31 00:00:00'}) AND (tgApunteContab.Diario Not Like 'A%' And tgApunteContab.Diario Not Like 'C31' And tgApunteContab.Diario Not Like 'g11' And tgApunteContab.Diario Not Like 'I31' And tgApunteContab.Diario Not Like 'I41' And tgApunteContab.Diario Not Like 'R%' And tgApunteContab.Diario Not Like 'V31' And tgApunteContab.Diario Not Like 'V41' And tgApunteContab.Diario Not Like 'V51' And tgApunteContab.Diario Not Like 'V61' And tgApunteContab.Diario Not Like 'C11' And tgApunteContab.Diario Not Like 'C51') AND (tgApunteContab.Peso Not Like '10' And tgApunteContab.Peso Not Like '45'))
ORDER BY tgApunteContab.Peso"
Sauf que c'est trop long... le tout est en rouge.
Même en utilisant l'enregistreur de macro, ça ne fonctionne pas. Déjà il ne me rapporte pas tout le texte de la requête Sql.
Je n'arrive pas à découper le texte. J'ai essayé avec " & _ " mais ça ne fonctionne pas.
Auriez-vous une petite idée ?
Merci par avance,
Sofhy