Access - CONTROL FICHERO EXTERNO

 
Vista:

CONTROL FICHERO EXTERNO

Publicado por jesus javier (2 intervenciones) el 08/03/2005 14:53:42
Function Importar()

On Error GoTo Importar_Err

Dim DirArch As String
'--- Dirección del archivo a importar ----------------------------------------------------------------
DirArch = Dir + "assets.txt"

¿COMO CONTROLO LA EXISTENCIA DEL FICHERO .TXT ANTES DE EJECUTAR LA TRANSFERENCIA DE LA SIGUIENTE LINEA? NO QUIERO QUE ME DE ERROR AL EJECUTAR, SI NO DETECTARLO ANTES.
¿EXISTE UN "IF FICHERO EXISTS" O ALGO PARECIDO?
UN SALUDO Y GRACIAS

DoCmd.TransferText acImportDelim, "ASSETS", "ASSETS", DirArch, False, ""

Importar_Exit:
Exit Function

Importar_Err:
MsgBox Error$
Resume Importar_Exit

End Function
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:CONTROL FICHERO EXTERNO

Publicado por 2pl (105 intervenciones) el 08/03/2005 17:33:55
If Not file("nombre del fchero") Then
.....
...
.
endif
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CONTROL FICHERO EXTERNO

Publicado por jesus javier (2 intervenciones) el 09/03/2005 11:09:01
Gracias por la respuesta, ahora me da el siguiente error:
Error de compilación
No se ha definido Sub o Function
y se posiciona el cursor en la palabra file:
If Not file("c:/gastos/assets.txt") Then
Estoy trabajando con Access 97.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CONTROL FICHERO EXTERNO

Publicado por Manuel (268 intervenciones) el 09/03/2005 18:43:44
Yo utilizo

if dir("c:/gastos/assets.txt") <> """ then
DoCmd.TransferText acImportDelim, "ASSETS", "ASSETS", DirArch, False, ""
else
docmd.cancelevent
end if

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar