I'm trying to tighten up the code in my database, so there is a function that I've made public. However, I don't have the syntax right for passing in the field that contains the parameter data.
Here's the public function:
and here's how I'm calling it:
Both the lines in the call give the same error, which is a compile error saying that this is an "invalid use of property", and pointing to the "ChartNum" field.
(Also, do you think I need the error handling in the public function? It seems pretty sturdy on its own, but I don't know.)
Here's the public function:
Code:
Function Open_eChart(strChartNum As String)
On Error GoTo Err_Open_eChart
Dim retVal As Variant
Dim strPartialPath As String
Const conPAth As String = "V:\IUR\eCharts\"
If IsNull(strChartNum) Then Exit Function
strPartialPath = Replace(Replace(strChartNum, "\", ""), ",", "_")
If Dir$(conPAth & strPartialPath, vbDirectory) = "" Then MkDir (conPAth & strPartialPath)
retVal = Shell("Explorer.exe " & conPAth & strPartialPath, vbNormalFocus)
Exit_Open_eChart:
Exit Function
Err_Open_eChart:
MsgBox Err.Description
Resume Exit_Open_eChart
End Function
Code:
Private Sub Open_eChart_Click()
'Open_eChart Me![ChartNum]
Open_eChart (Me![ChartNum])
End Sub
(Also, do you think I need the error handling in the public function? It seems pretty sturdy on its own, but I don't know.)
Comment