Hello. I'm having issues with a MS Access Public Function that resides in a standalone Module. It is pasted below. When I run the code, it gives me the exact alphabetized list from an array that I was hoping for. However, when I try to add an argument to the Function so I can pass values to it, I get the attached macro dialog. I have no idea why this is happening and would really appreciate some help.
Public Function SplitCleanup(strOrphans As String) As String
Dim intRow As Integer
Dim astrOrphans() As String
On Error GoTo ErrorHandler
SplitCleanup = ""
'strOrphans = ";#Electrophoresis;#Gas Chromatography;#Liquid Chromatography;#Mass Spectrometry;#Services;#Instrument Parts & Supplies;#Columns & Supplies;#Atomic Spectroscopy;#"
If Len(strOrphans) > 0 Then
astrOrphans = Split(strOrphans, ";#")
With WizHook
.Key = 51488399
.SortStringArray astrOrphans
End With
For intRow = 0 To UBound(astrOrphans)
DoCmd.SetWarnings (0)
SplitCleanup = SplitCleanup & Replace(astrOrphans(intRow), "'", "''") & vbCrLf
DoCmd.SetWarnings (1)
Next intRow
MsgBox (SplitCleanup)
End If
Exit Function
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
End Function
Thanks for looking.
Newbie Bill
Public Function SplitCleanup(strOrphans As String) As String
Dim intRow As Integer
Dim astrOrphans() As String
On Error GoTo ErrorHandler
SplitCleanup = ""
'strOrphans = ";#Electrophoresis;#Gas Chromatography;#Liquid Chromatography;#Mass Spectrometry;#Services;#Instrument Parts & Supplies;#Columns & Supplies;#Atomic Spectroscopy;#"
If Len(strOrphans) > 0 Then
astrOrphans = Split(strOrphans, ";#")
With WizHook
.Key = 51488399
.SortStringArray astrOrphans
End With
For intRow = 0 To UBound(astrOrphans)
DoCmd.SetWarnings (0)
SplitCleanup = SplitCleanup & Replace(astrOrphans(intRow), "'", "''") & vbCrLf
DoCmd.SetWarnings (1)
Next intRow
MsgBox (SplitCleanup)
End If
Exit Function
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
End Function
Thanks for looking.
Newbie Bill