ldb Open

  • Thread starter Thread starter Douglas J. Steele
  • Start date Start date
D

Douglas J. Steele

To only have your code run when the file doesn't exist, you need

If Me.TxtFile = 0 Then

The Dir function returns the file name without its path if the file exists,
or a zero-length string ("") if the file doesn't exist.
 
I'm running this code that compacts and repairs my backend the problem
is the ldb always seems to be open, there are no users on and no forms
are open, only the one I'm running the code from. Any reason for this?

Me.TxtFile = Len(Dir$("C:\PROSERV\DB\Data.ldb"))
If Me.TxtFile >= 1 Then
Name "C:\PROSERV\DB\Data.mdb" As "C:\PROSERV\DB\OldData.mdb"
DBEngine.CompactDatabase "C:\PROSERV\DB\OLDData.mdb",
"C:\PROSERV\DB\Data.mdb"
Kill "C:\PROSERV\DB\OldData.mdb"
DoCmd.OpenForm "Form2"
ElseIf Me.TxtFile = 0 Then
End If

Thanks
DS
 
Douglas said:
To only have your code run when the file doesn't exist, you need

If Me.TxtFile = 0 Then

The Dir function returns the file name without its path if the file exists,
or a zero-length string ("") if the file doesn't exist.
Your Right.
Thanks Douglas'
DS
 
Back
Top