Just wondering what the proper syntax would be for something like this so it does not return the error above:
Thanks
LB
Code:
Function DlookUp_In_Access(ByVal strLookUpFieldName As String, _
ByVal strTableName As String, _
ByVal Critera As String)
Dim con As OleDbConnection
Try
con = New OleDbConnection(cs)
Dim dbCmd As OleDbCommand = New OleDbCommand("select " & strLookUpFieldName & " from " & strTableName & _
" WHERE " & Critera, con)
con.Open()
'MessageBox.Show(dbCmd.ExecuteScalar().ToString)
Return dbCmd.ExecuteScalar().ToString
con.Close()
Catch ex As Exception
Dim el As New ErrorLogger
el.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End FunctionLB