Strange one? not compiling

Sam Summers

Registered User.
Local time
Today, 06:30
Joined
Sep 17, 2001
Messages
939
Hi,

I have a database that i have deployed on my works network. I created it on my machine that is running Access 2002 developer. The works system is running 2003.

Various strange things are happening regarding totalling in supreports. When i try to compile it is breaking at this line of code:

Dim OFN As OPENFILENAME

The database compiles fine on my machine. I have checked the references and they are identical except for the Access object library which is version 10 on my machine and version 11 on the companies system.

Any ideas anyone?

Thank you very much in advance
 
Have you defined the type OPENFILENAME right above this Dim line in the module?
 
I havent, but then i havent in the copy i have on my machine that works?
Not really sure how actually. I just tried and it didn't seem to work?
 
Last edited:
Here is the full code i am using:

Private Sub cmdInsertPic_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click

' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([Cert]) Then .lpstrFile = [Cert]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files (*.tif;*.tiff;*.bmp;*.gif;*.jpg;*.wmf)", "*.tif;*.tiff;*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With

If OpenDialog(OFN) Then
[Cert] = OFN.lpstrFile
[imgPicture].Picture = [Cert]
SysCmd acSysCmdSetStatus, "Certificate: '" & [Cert] & "'."
End If
Exit Sub

Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub


Thank you for your help with this.
 
Hi Sam,
While viewing the code you just posted, highlight OPENFILENAME and go to Edit>Find and select "Search Current Project". See how many places it is used and see if you can locate where it is defined. It looks like it is part of a File Open/Save Dialog but you are missing some of the pieces.
 
Maybe this will help in deciphering the structure differences between 2002 and 2003...

Office 2003 Editions: Access VBA Language Reference
http://www.microsoft.com/downloads/details.aspx?FamilyID=0447C5A0-5E58-4E69-B90E-C42EC7DBF887&displaylang=en

------------------Edit----------------

Whoops... that doesn't have any references to OPENFILENAME dialog in it, but it may help in other basic areas... Googling for similar issues...

How to use the Command Dialog API in a database in Access 2003
http://support.microsoft.com/Default.aspx?kbid=888695

BrowseFolder Dialog
http://www.mvps.org/access/api/api0002.htm
 
Last edited:
I have tried and tried with all this and just cant get this to work, even though it worked fine on all previous versions of Access.

It breaks everytime at "Dim OFN As OPENFILENAME" saying user defined type not defined.
I just cant get to grips with this at all!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Hi Sam,

Can you post a stripped down version of your db that demonstrates the problem?
 
Hi thanks for getting back to me so quick. The file would be too big to post.
It just keeps failing at Dim OFN As OPENFILENAME
Saying that OFN is undeclared. Although it works fine in all previous versions of Access just not in 2003?
What i have done is actually removed this facility from the Database until i ever find the reason.:confused:
 

Users who are viewing this thread

Back
Top Bottom