troubleshooting Question

What does mean

Avatar of cacha18cr
cacha18crFlag for Costa Rica asked on
Microsoft Excel
4 Comments1 Solution303 ViewsLast Modified:
I'm trying to take data from AS400 and using a VBA Macro in excel refresh a qry. But when the refreshment table excel gives me the following error
Error
Attached macro

Sub Actualizar()
   
    vBarco = Trim(Sheets("Menu").Range("D10"))
    vViaje = Trim(Sheets("Menu").Range("D11"))
    vLiner = Trim(Sheets("Menu").Range("D12"))
    vPais = Trim(Sheets("Menu").Range("E13"))
   
    Sheets("DTLTrace").Select
    Range("A1").Select
    With ActiveWorkbook.Connections("BarcoViajeDestino").ODBCConnection
        .BackgroundQuery = False
        .CommandText = Array("SELECT  FLTMRES.CNMCTE as Contenedor , FLTMMAN.CNMCTP as Prefijo, SCENEM as Embarque " _
            , ", FLTMMAN.ORFCOD as Empacadora " _
            , ", FLTMCNT.CNMFEH AS FechaLlegada " _
            , ", FLTMCNT.CNMFEH AS HoraLlegada " _
            , ", FLTMCNT.CNMLCH as  MatriculaChasis, FLTMCNT.CNMSLL as SelloLlegada " _
            , " FROM DOLDATTRC.FLTMRES FLTMRES,DOLDATTRC.FLTMMAN FLTMMAN,DOLDATTRC.FLTPPROD FLTPPROD,DOLDATTRC.FLTEEMBA FLTEEMBA," _
            , " DOLDATTRC.FLTMCNT FLTMCNT, DOLDATTRC.FLTFORIG FLTFORIG, DOLDATTRC.FLTESHIP FLTESHIP, DOLDATTRC.FLTFFINC FLTFFINC, " _
            , " DOLDATTRC.FLTESCHE FLTESCHE, DOLDATTRC.FLTFENTI FLTFENTI, DOLDATTRC.FLTMTDES FLTMTDES,DOLDATTRC.FLTEPORT FLTEPORT" _
            , " WHERE FLTMRES.PAFCOD = FLTMMAN.PAFCOD AND FLTMRES.FIFCOD = FLTMMAN.FIFCOD AND FLTMRES.ORFCOD = FLTMMAN.ORFCOD" _
            , " AND FLTMRES.MAMDOC = FLTMMAN.MAMDOC AND FLTMRES.PAFCOD = FLTPPROD.PAFCOD AND FLTMRES.PRPNKN = FLTPPROD.PRPNKN " _
            , " AND FLTMRES.SHECOD = FLTEEMBA.SHECOD AND FLTMRES.EMENVI = FLTEEMBA.EMENVI AND FLTMRES.PAFCOD = FLTFORIG.PAFCOD " _
            , " AND FLTMRES.DEMORG = FLTFORIG.ORFCOD AND FLTMRES.SHECOD = FLTESHIP.SHECOD AND FLTMMAN.MAMPTO = FLTEPORT.POECOD " _
            , " AND FLTMRES.PAFCOD = FLTMCNT.PAFCOD AND FLTMRES.CNMCTP = FLTMCNT.CNMCTP AND FLTMRES.CNMCTE = FLTMCNT.CNMCTE " _
            , " AND FLTMRES.FIFCOD = FLTMCNT.FIFCOD AND FLTMRES.MAMDOC = FLTMCNT.CNMDOC AND FLTMRES.PAFCOD = FLTFFINC.PAFCOD " _
            , " AND FLTMRES.DEMFIC = FLTFFINC.FIFCOD AND FLTMRES.SHECOD = FLTESCHE.SHECOD AND FLTMRES.EMENVI = FLTESCHE.EMENVI " _
            , " AND FLTMRES.PAFCOD = FLTESCHE.SCEPAI AND FLTFFINC.PAFCOD = FLTFENTI.PAFCOD AND FLTFFINC.ENFCOD = FLTFENTI.ENFCOD " _
            , " AND FLTMMAN.TDMCOD = FLTMTDES.TDMCOD " _
            , " rs.PAFCOD = '" & vPais & "' AND FLTEEMBA.SHECOD = '" & vBarco & "' AND FLTEEMBA.EMENVE = '" & vViaje & "' AND FLTEEMBA.ELICOD = '" & vLiner & "' ")
        .Refresh
    End With
ASKER CERTIFIED SOLUTION
Jerry Miller

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros