Convert Class Module to Standard Module

G

Guest

Hi,

I a novice in terms of standard modules, and I was wondering how I might go
about changing this class module that appears on many different reports so
that all these reports refer to the one standard module.

I can't seem to get my head around what to replace the Me keyword with,
because the report will vary each time.

Here's the code:

Dim Res As Boolean
Dim fName As String
path = ""
On Error Resume Next
If Not IsNull(Me!ImagePath1) Then
Res = IsRelative(Me!ImagePath1)
fName = Me![imagepath]
If (Res = True) Then
fName = path & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
End If
Else
hideImageFrame
End If

End Function
 
P

Pat Hartman

You need to pass a form object as an argument. Then you would replace Me.
with the argument.

Public Function YourFunc(frm as Form)
....
....
If Not IsNull(frm.ImagePath1) Then
.....
 
G

Guest

Thanks. I think I might a bit more information on this. Can anyone recommend
any online resources or articles about standard modules for beginners?

Pat Hartman said:
You need to pass a form object as an argument. Then you would replace Me.
with the argument.

Public Function YourFunc(frm as Form)
....
....
If Not IsNull(frm.ImagePath1) Then
.....


Murp said:
Hi,

I a novice in terms of standard modules, and I was wondering how I might go
about changing this class module that appears on many different reports so
that all these reports refer to the one standard module.

I can't seem to get my head around what to replace the Me keyword with,
because the report will vary each time.

Here's the code:

Dim Res As Boolean
Dim fName As String
path = ""
On Error Resume Next
If Not IsNull(Me!ImagePath1) Then
Res = IsRelative(Me!ImagePath1)
fName = Me![imagepath]
If (Res = True) Then
fName = path & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
End If
Else
hideImageFrame
End If

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top