On Mar 9, 11:20*am, mcolson <mcolson1...@newsgroup> wrote:
> I am using the following code to perform a SQL query and return a
> recordset *I am getting the error "Arguments are of the wrong type,
> are out of acceptable range, or are in conflict with one another"
> This error occurs when I open the record set. *What am I doing wrong?
>
> Const adOpenStatic = 3
> Const adLockOptimistic = 3
> Const adUseClient = 3
> Set objConnection = CreateObject("ADODB.Connection")
> Set objRecordset = CreateObject("ADODB.Recordset")
> objConnection.Open "DSN=ChartMES;"
> objRecordset.CursorLocation = adUseClient
>
> strQuery = "Use ChartMES " _
> * * * * & "SELECT EmployeeID " _
> * * & "FROM dbo.viewEmployeeTraining " _
> * * & "WHERE TrainingName = 'Inner / Outer Mass Spec Training' " _
> * * & "ORDER BY EmployeeID"
>
> ' Echo the query to the console to verify.
> Wscript.Echo strQuery
>
> 'objRecordset.Source = strQuery
> objRecordset.Open strQuery, objConnection, adOpenStatic,
> adLockOpstimistic
> If objRecordset.EOF Then
> * * Wscript.Echo "Record cannot be found."
> Else
> * * Wscript.Echo "Record found."
> End If
> objRecordset.Close
> objRecordset.Close Is there a typo in this line ?...
objRecordset.Open strQuery, objConnection, adOpenStatic,
adLockOpstimistic
I think you intended the last constant to be "adLockOptimistic" (no S
after the P).
_____________________
Tom Lavedas