Heb binnen Acces de volgende module die een kopie maakt van de actieve database
Option Explicit
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Sub copyfile(sourcefile As String, destfile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long
If Dir(sourcefile) = "" Then
MsgBox Chr(34) & sourcefile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(sourcefile, destfile, False)
End If
End Sub
Public Function test()
copyfile "c:\test.mdb", "C:\temp\test2.mdb"
End Function
IK wil echter dat de destfile niet een constante is maar een variabele namelijk:
c:\temp\(currentdate).mdb
Er moet namelijk iedere dag een nieuwe backup gemaakt worden en iedere backup moet bewaard blijven met de juiste datum.
Iemand suggesties??
Overigens nog een tweede vraagje: is het nog zinvol om me te verdiepen in VBA zoals het in acces gebruikt wordt? (we gaan sowieso binnenkort op XP over, weet niet of dat de zaken verandert) of is dat inmiddels achterhaald. Zo ja welk boek kan ik dan het beste aanschaffen (ga het alleen binnen acces gebruiken)
Option Explicit
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Sub copyfile(sourcefile As String, destfile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long
If Dir(sourcefile) = "" Then
MsgBox Chr(34) & sourcefile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(sourcefile, destfile, False)
End If
End Sub
Public Function test()
copyfile "c:\test.mdb", "C:\temp\test2.mdb"
End Function
IK wil echter dat de destfile niet een constante is maar een variabele namelijk:
c:\temp\(currentdate).mdb
Er moet namelijk iedere dag een nieuwe backup gemaakt worden en iedere backup moet bewaard blijven met de juiste datum.
Iemand suggesties??
Overigens nog een tweede vraagje: is het nog zinvol om me te verdiepen in VBA zoals het in acces gebruikt wordt? (we gaan sowieso binnenkort op XP over, weet niet of dat de zaken verandert) of is dat inmiddels achterhaald. Zo ja welk boek kan ik dan het beste aanschaffen (ga het alleen binnen acces gebruiken)