E
efandango
Can anybody help with this dire problem i have?
I have recently re-installed MS Access and now get the following errors when
I open my Main Form.
I haven’t changed any references to image paths or other associated files.
These are the messages I get when I first open the database.
'Project contains a missing or broken reference to the file
'AudioControls2.ocx' version 1.0'
'Project contains a missing or broken reference to the file
'AudioControls2.ocx' version 2.0'
These are the errors I get when I try to open the form, they appear in the
VBA debugger
'Compile Error:
Can't find project or library'
The debugger highlights the following code lines (see complete module code
detailed at bottom of this post):
(Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage)
and
the word 'Left' in this line:
strDatabasePath = Left(strDatabasePath, intSlashLocation)
These are the errors I get when I try to close the Debugger
Undefined function 'Format' in expression
Undefined function 'Date' in expression
Undefined function 'Trim' in expression
This is the complete module code:
Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage
Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer
With ctlImageControl
If IsNull(strImagePath) Then
.Visible = False
strResult = "No image name specified."
Else
If InStr(1, strImagePath, "\") = 0 Then
' Path is relative
strDatabasePath = CurrentProject.FullName
intSlashLocation = InStrRev(strDatabasePath, "\",
Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
End If
.Visible = True
.Picture = strImagePath
strResult = "Image found and displayed."
End If
End With
Exit_DisplayImage:
DisplayImage = strResult
Exit Function
Err_DisplayImage:
Select Case Err.Number
Case 2220 ' Can't find the picture.
ctlImageControl.Visible = False
strResult = "Can't find image in the specified name."
Resume Exit_DisplayImage:
Case Else ' Some other error.
MsgBox Err.Number & " " & Err.Description
strResult = "An error occurred displaying image."
Resume Exit_DisplayImage:
End Select
End Function
I have recently re-installed MS Access and now get the following errors when
I open my Main Form.
I haven’t changed any references to image paths or other associated files.
These are the messages I get when I first open the database.
'Project contains a missing or broken reference to the file
'AudioControls2.ocx' version 1.0'
'Project contains a missing or broken reference to the file
'AudioControls2.ocx' version 2.0'
These are the errors I get when I try to open the form, they appear in the
VBA debugger
'Compile Error:
Can't find project or library'
The debugger highlights the following code lines (see complete module code
detailed at bottom of this post):
(Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage)
and
the word 'Left' in this line:
strDatabasePath = Left(strDatabasePath, intSlashLocation)
These are the errors I get when I try to close the Debugger
Undefined function 'Format' in expression
Undefined function 'Date' in expression
Undefined function 'Trim' in expression
This is the complete module code:
Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage
Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer
With ctlImageControl
If IsNull(strImagePath) Then
.Visible = False
strResult = "No image name specified."
Else
If InStr(1, strImagePath, "\") = 0 Then
' Path is relative
strDatabasePath = CurrentProject.FullName
intSlashLocation = InStrRev(strDatabasePath, "\",
Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
End If
.Visible = True
.Picture = strImagePath
strResult = "Image found and displayed."
End If
End With
Exit_DisplayImage:
DisplayImage = strResult
Exit Function
Err_DisplayImage:
Select Case Err.Number
Case 2220 ' Can't find the picture.
ctlImageControl.Visible = False
strResult = "Can't find image in the specified name."
Resume Exit_DisplayImage:
Case Else ' Some other error.
MsgBox Err.Number & " " & Err.Description
strResult = "An error occurred displaying image."
Resume Exit_DisplayImage:
End Select
End Function