Backup Utillity - Compile Error: User Defined Type Not Defined (1 Viewer)

Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
Hi,

I have a backup utility in which I previously used all the time. Now it's come up with the following error

Compile Error:
User-Defined Type Not Defined

Usually you selected your paths and then clicked back-up. If you had a registered copy of WinZip it created a backup called e.g. backup.zip
If you did not have a registered WinZip it made a file called e.g. backup.mdb

Can’t remember where I got this but it's a great little effort. :D

I have included db to view error.
 

Attachments

  • backup (2000).zip
    45.7 KB · Views: 284
  • backup (2002-2003).zip
    46.9 KB · Views: 353

alastair69

Registered User.
Local time
Today, 13:57
Joined
Dec 21, 2004
Messages
562
The item "filesystemobject" is not found and as a result errors, either there is a file reference missing or not selected. I have looked though the object browsers and got not find any reference to "filesystemobject". I take it this may of been taken from an old access version. I will have a look on the microsoft site and see if it has been replaced by a new command.

Alastair
 
Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
Thanks

Much appreciated
 

alastair69

Registered User.
Local time
Today, 13:57
Joined
Dec 21, 2004
Messages
562
I have got your backup database working, i have add my name to the parts i have changed.

Alastair
 

Attachments

  • backup (2002-2003).zip
    53.3 KB · Views: 347
Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
Hi,

Thanks for the reply.

Did you post the right db on the site as it's doing the same thing for me still.

Compile Error:

Thanks
Dean
 
Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
When i click back up it brings up a box to confirm winzip is found and everything is fine but visual basic then comes up with an error beside "Compile error: User-Defined type not defined"

This is what is highlighted in vb:

Function ZipandBackUpDb() 'WinZip Found
On Error GoTo Err_BackUpDb

Dim fso As filesystemobject

Any idea's.
 
Last edited:

alastair69

Registered User.
Local time
Today, 13:57
Joined
Dec 21, 2004
Messages
562
Dean,

I do not have win zip but, you could try and see if the attached works, I have copied the lines from the Non Win Zip function, see if this sorts you out.

Alastair
 

Attachments

  • backup (2002-2003).zip
    81.2 KB · Views: 227

alastair69

Registered User.
Local time
Today, 13:57
Joined
Dec 21, 2004
Messages
562
After looking on Microsoft Internet page i found that your code "Dim fso As filesystemobject" should be "Dim fso, fl"

Alastair
 
Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
after you changed it to fl it went straight pass that error and onto

Set fso = New filesystemobject

does this mean that all "filesystemobject" should be changed to "fl"

thanks again.
 

alastair69

Registered User.
Local time
Today, 13:57
Joined
Dec 21, 2004
Messages
562
Sorry Missed That section

Please find the enclosed and see if that works let me know if not and i will try again.

Alastair
 

Attachments

  • backup (2002-2003).zip
    53 KB · Views: 315

modest

Registered User.
Local time
Today, 16:57
Joined
Jan 4, 2005
Messages
1,220
That utility is not backing up correctly; it has 2 problems so far:
1) it is saying the disk is full when copying the backup from the temp file
2) it is not saving the file as a .zip file

I will take a look at these problems and repost the database when I find a solution.
 

modest

Registered User.
Local time
Today, 16:57
Joined
Jan 4, 2005
Messages
1,220
Nevermind my previous post; I have found the problem.

Here are things you might want to change:
1) You do not need to create two filesystemobjects when creating the backup.

Move set fso = Nothing to the end of the file and get rid of the second Set fso = CreateObject("Scripting.FileSystemObject").

2) The backup utility wasnt working for me because I do not have a fully licensed version of WinZip; I still have an evaluation version. The backup will not initialize until you select "Use Evaluation Version" from the winzip pop-up. However, this does not pop-up because you have hidden the shell. I will look into how you can bypass this so that the backup utility works for both licensed and evaluation versions.
 

modest

Registered User.
Local time
Today, 16:57
Joined
Jan 4, 2005
Messages
1,220
ghudson said:
I believe that the answer is buried within this thread...
Back up and zip code from ghudson

I just read the thread and didnt find anything that had the same problem. To be honest, I think there is a better way of zipping files using WinXP instead of a third-party compressor such as WinZip or WinRar/WinAce.
 

ghudson

Registered User.
Local time
Today, 16:57
Joined
Jun 8, 2002
Messages
6,195
modest said:
I just read the thread and didnt find anything that had the same problem.
I thought the workaround to using the evaluation version of WinZip was discussed. I never tried it since I always use WinZip.

modest said:
I think there is a better way of zipping files using WinXP instead of a third-party compressor such as WinZip or WinRar/WinAce.
That has already been discussed in the Unzipping files thread. I posted some links that will provide you with the code to zip/unzip using the built-in Windows XP zipping functions. I only played around with the unzipping code in the links I provided last week and it worked.
 
Local time
Tomorrow, 06:57
Joined
Feb 8, 2005
Messages
92
The latest one that alastair69 provided worked fine for me but i have a registered version of winzip.One thing i remember from a while ago when i used to use it a lot was that if you backed up without winzip installed it said can't find winzip making a backup copy of database.Or something like that anyway.I just know it still used to work if you didn't have winzip.

If this is easy let me know but i use Quickbooks for my financials and noticed that after a couple days if you haven't backup in a while it tells you and says would you like to backup know.Would this be hard to do.

Thanks for all the help It's much appreciated.

Dean
 

zebias zingoni

New member
Local time
Today, 23:57
Joined
Jun 8, 2008
Messages
1
compile error user defined type not defined

changing the code 'Dim fso As New FileSystemObject' to
Dim fso, fl helped in removing the error. The option allows me to backup my database but i cannot locate the database that i backup.

the full piece pf code is
Private Sub tools_Click()

Dim fName As String, src As String

Dim fso, fl
cdl.Filter = "All MS Access Database Files(*.mdb)|*.mdb"
cdl.InitDir = App.Path
cdl.DialogTitle = "Databse Backup"
cdl.ShowSave


fName = cdl.FileName
If Len(Trim(fName)) = 0 Then Exit Sub
src = IIf(Right(App.Path, 1) = "\", App.Path & "dbCenpap.mdb", App.Path & "\dbcenpap.mdb")
If CopyFile(src, fName, 1) = 0 Then
If MsgBox("File With the same name exists already in current folder. Do you want to overwrite the existing file?", vbYesNo + vbQuestion, "Confirm Overwrit") = vbNo Then Exit Sub
CopyFile src, fName, 0
MsgBox "Databse Backup Completed Sucessfully", vbInformation, "Backup Successfull."
Else
MsgBox "Databse Backup Completed Sucessfully", vbInformation, "Backup Successfull."
End If
End Sub
 

Users who are viewing this thread

Top Bottom