Hi Guys, here is my first stab at programming using VBA, I need to get this working PDQ, can you see why I am getting this error:
"Compile Error: Function call on left hand side of assignement must return Variant or Object"
Here is the function giving me the problem;
Function Checkload(LoadID As Long) As Boolean
Dim cn As New ADODB.Connection
Dim StrSQL As String
On Error GoTo Errorhandler
cn.Open CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
StrSQL = "SELECT * FROM tblConsignment WHERE LoadID = " & LoadID & ""
rs.Open StrSQL, cn
If rs.RecordCount > 0 Then
Checkload(LoadID) = True
Else
Checkload(LoadID) = False
End If
'close connections
rs.Close
cn.Close
Set cn = Nothing
Set rs = Nothing
End Function
"Compile Error: Function call on left hand side of assignement must return Variant or Object"
Here is the function giving me the problem;
Function Checkload(LoadID As Long) As Boolean
Dim cn As New ADODB.Connection
Dim StrSQL As String
On Error GoTo Errorhandler
cn.Open CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
StrSQL = "SELECT * FROM tblConsignment WHERE LoadID = " & LoadID & ""
rs.Open StrSQL, cn
If rs.RecordCount > 0 Then
Checkload(LoadID) = True
Else
Checkload(LoadID) = False
End If
'close connections
rs.Close
cn.Close
Set cn = Nothing
Set rs = Nothing
End Function