View Full Version : compile error using oldsoftbosses image sample


malum
03-01-2005, 04:36 AM
I am using picture2k.zip which I have downloaded
see here by Oldsoftboss http://www.access-programmers.co.uk/forums/showthread.php?t=62251

I want to use it in another database that I have already set up but I can't get it to work. I get this:

compile error
user defined type not defined

It works fine on it's own but not as a separate form in the other database. (I eventually want to integrate the picture into the main database form but I need it to work first)


This
is the bit it brings up with Dim db As DAO.Database highlighted

Private Function GetPathPart() As String
' Comments : Returns the path part of a string
' Parameters: strPath - string to parse
' Returns : path part
'
Dim db As DAO.Database
Dim strPath As String
Dim intCounter As Integer

Set db = CurrentDb
strPath = db.Name
db.Close
Set db = Nothing


For intCounter = Len(strPath) To 1 Step -1
If Mid$(strPath, intCounter, 1) = "\" Then
Exit For
End If
Next intCounter

GetPathPart = Left$(strPath, intCounter)

I have imported the table and the form and when I type in the filename to display (in the form) it updates the table as it should


I should add that I know no VB at all (although I managed to change the relative path without a problem but checking out other posts here)

Any help appreciated.

If I don't answer for a while it's because my Mrs is due to give birth imminently. I will get back here when I can :D

malum
03-01-2005, 08:00 AM
Sorted

For some reason it worked if I created a new database and just exported all the tables and queries + the new image table into that but not if I exported to the old database.

Anyway I now have it in the main form and it works fine (in case anyone else comes across this problem)

My thanks to Oldsoftboss for the demo database

No baby yet either :)

modest
03-01-2005, 02:33 PM
You either:

1) had no "End Function" at the end of the function
2) your old database didn't have the correct reference

or
3) you just needed to compact and repair the database

malum
03-01-2005, 02:39 PM
You either:

1) had no "End Function" at the end of the function
2) your old database didn't have the correct reference

or
3) you just needed to compact and repair the database

I tried 3 with no change

I dragged all the tables and forms to the new database and made no further changes and it worked fine. Very odd

thanks for taking the time to look :)

modest
03-01-2005, 02:59 PM
Well... all I can say is that copying into a new database rids a lot of errors. I used to experience some sort of error on close. I think it had to do with a bad index, or an unlisted object (who even knows anymore).

The only way that microsoft had to solve it was to copy into a new database.

malum
03-02-2005, 01:15 AM
Well... all I can say is that copying into a new database rids a lot of errors. I used to experience some sort of error on close. I think it had to do with a bad index, or an unlisted object (who even knows anymore).

The only way that microsoft had to solve it was to copy into a new database.

I'm just glad it works now

Of course I would have been happier if it hadn't taken me half a day to think of creating a new database :eek:

I'll know next time

modest
03-02-2005, 07:38 AM
some give up before then :)