en un lugar a elección del usuario.
pero si el usuario elige una carpeta que no se automonta en el sistema (tengo muchas particiones y discos en mi pc) da error aunque no se cuelga el programa porque le puse código para ello.
ahora bien, al parecer parece lógico que es uno que tiene que montar la carpeta si no esta montada, que es lo que voy a intentar hacer para solucionar el tema.
como manejarían ese tema ustedes?
Public Sub RespaldarAhora()
Dim FechaM As Date
Dim BD As String
DirRespaldo = Settings["RespaldoAutomatico/DirRespaldo", RespaldoBD]
CadaTanto = Settings["RespaldoAutomatico/Periodo", 0]
BD = FMain.CarpetaTaller &/ "basetaller"
If Exist(BD) Then
FechaM = Stat(BD).LastModified
Endif
ArchivoX = FMain.DirRespaldo &/ "basetaller_" & Replace$(CString(Date), "/", "-")
Select Case CadaTanto
Case 0
If DateDiff(Date, FechaM, gb.Day) <= 0 Then
If Exist(ArchivoX) = False Then
If Access(File.Dir(ArchivoX), gb.Write) = True Then
Copy BD To ArchivoX
Wait 0.2
VerificarRespaldo
Else
TextoMSG("Error:" & Error.Text & gb.NewLine & Error.Where, True)
Endif
Else
If bVerMensaje = True Then
TextoMSG("Respaldo ya existe:" & gb.NewLine & ArchivoX, True)
bVerMensaje = False
Endif
Endif
Endif
Case 1
If DateDiff(Date, FechaM, gb.Day) < 6 Then
If Exist(ArchivoX) = False Then
If Access(File.Dir(ArchivoX), gb.Write) = True Then
Copy BD To ArchivoX
Wait 0.2
VerificarRespaldo
Else
TextoMSG("No se pudo acceder a:" & gb.NewLine & ArchivoX, True)
Endif
Else
If bVerMensaje = True Then
TextoMSG("Respaldo ya existe:" & gb.NewLine & ArchivoX, True)
bVerMensaje = False
Endif
Endif
Endif
End Select
End
Public Sub VerificarRespaldo()
If Exist(ArchivoX) Then
Goto RESPALDO_CORRECTO
Else
Goto ERROR_RESPALDO
Endif
RESPALDO_CORRECTO:
TextoMSG("Se respaldo correctamente en:" & gb.NewLine & ArchivoX, False)
' Message.Info("Se respaldo correctamente en:" & gb.NewLine & ArchivoX)
Goto SALIR
ERROR_RESPALDO:
TextoMSG("Ocurrio un error:" & gb.NewLine & Error.Text & gb.NewLine & Error.Where, True)
SALIR:
End
Dim FechaM As Date
Dim BD As String
DirRespaldo = Settings["RespaldoAutomatico/DirRespaldo", RespaldoBD]
CadaTanto = Settings["RespaldoAutomatico/Periodo", 0]
BD = FMain.CarpetaTaller &/ "basetaller"
If Exist(BD) Then
FechaM = Stat(BD).LastModified
Endif
ArchivoX = FMain.DirRespaldo &/ "basetaller_" & Replace$(CString(Date), "/", "-")
Select Case CadaTanto
Case 0
If DateDiff(Date, FechaM, gb.Day) <= 0 Then
If Exist(ArchivoX) = False Then
If Access(File.Dir(ArchivoX), gb.Write) = True Then
Copy BD To ArchivoX
Wait 0.2
VerificarRespaldo
Else
TextoMSG("Error:" & Error.Text & gb.NewLine & Error.Where, True)
Endif
Else
If bVerMensaje = True Then
TextoMSG("Respaldo ya existe:" & gb.NewLine & ArchivoX, True)
bVerMensaje = False
Endif
Endif
Endif
Case 1
If DateDiff(Date, FechaM, gb.Day) < 6 Then
If Exist(ArchivoX) = False Then
If Access(File.Dir(ArchivoX), gb.Write) = True Then
Copy BD To ArchivoX
Wait 0.2
VerificarRespaldo
Else
TextoMSG("No se pudo acceder a:" & gb.NewLine & ArchivoX, True)
Endif
Else
If bVerMensaje = True Then
TextoMSG("Respaldo ya existe:" & gb.NewLine & ArchivoX, True)
bVerMensaje = False
Endif
Endif
Endif
End Select
End
Public Sub VerificarRespaldo()
If Exist(ArchivoX) Then
Goto RESPALDO_CORRECTO
Else
Goto ERROR_RESPALDO
Endif
RESPALDO_CORRECTO:
TextoMSG("Se respaldo correctamente en:" & gb.NewLine & ArchivoX, False)
' Message.Info("Se respaldo correctamente en:" & gb.NewLine & ArchivoX)
Goto SALIR
ERROR_RESPALDO:
TextoMSG("Ocurrio un error:" & gb.NewLine & Error.Text & gb.NewLine & Error.Where, True)
SALIR:
End