• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

throwing runtime error 3001

Hi All,


Im using the below adodb query to connect to access db but in the last line rsdata.open im getting run time error 3001 and arguments are of wrong type,are out of acceptable range,or are in conflict with one another.

can any one help me on this .below is query.


Sub DbConnection()

Dim conn As ADODB.Connection

Dim sqlstr As String

'Dim rsData As Recordset

Set conn = New ADODB.Connection

If conn.State = 1 Then conn.Close

sqlstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ThisWorkbook.Path & "DeliveryDb.mdb;Persist Security Info=False"

conn.Open sqlstr

Dim rsData As New ADODB.Recordset

If rsData.State = 1 Then rsData.Close

rsData.Open " SELECT distinct region from Delivery ", oConn, adOpenStatic, adLockOptimistic


End Sub


Regards,
 
Brijendraydv


I am taking a guess here but have you tried removing the extra spaces inside the " signs

in front of Select and after Delivery?


Also you haven't defined oConn, adOpenStatic or adLockOptimistic anywhere ?
 
Hi Hui,


You are great,i always look for these advanced concepts from you guys.

i think there is no need to define adOpenStatic or adLockOptimistic as its running fine for me now when i corrected oconn with conn.


Thanks and Regards,
 
Back
Top