I am getting this error run-time error '3001': Arguments are of the wrong type, are out of acceptable range, or are in conflict with o

tiger123

New Member
Joined
Jun 24, 2014
Messages
37
i have code link this to Update data in mysql through excel Please help me out

i have made some changes in mysql db

I HAVE TAKEN IN MYSQL DB(Column) WMS_ID AS VARCHAR(45) AND A PRIMARY KEY

example:This is my table whos Column look like this i am trying to make this column unique

WMS_ID


WMS10001
WMS10002
WMS10003
WMS10004
WMS10005
WMS10006


Code:
Dim dbconn As New ADODB.Connection     Dim stDB, strConn


     Dim totColumns, totRows, i, j, BMS_id, UpdateprBatchName
     Dim prBatchName, prTableQry, inTableQry, prTableQry1, dbQry
     Dim rs As New ADODB.Recordset


     'Path to the database.
      stDB = "mysql32"


     'Create the connectionstring.
      strConn = "Driver=MySQL ODBC 5.2 Unicode Driver;" _
      & "Data Source=" & stDB & ";"


      Sheet1.Activate
     'prBatchName = "tblprod_agr_007"


      totColumns = ActiveSheet.Cells(2, 1).CurrentRegion.Columns.Count
      totRows = ActiveSheet.Cells(3, 1).CurrentRegion.Rows.Count


      'prBatchName = ActiveSheet.Cells(3, totColumns + 1).Values
      dbconn.Open strConn
      rs.CursorLocation = adUseServer
      rs.Open "select * from " & InputBox("Update Data"), dbconn, adOpenStatic,      
      adLockOptimistic
       For j = 3 To totRows + 1
       WMS_id = ActiveSheet.Cells(j, 1)
        rs.Find "WMS_ID=" & BMS_id
        
        For i = 2 To totColumns
        rs(ActiveSheet.Cells(2, i).Value) = ActiveSheet.Cells(j, i)
        Next
        rs.Update
          Next
        rs.Close
        dbconn.Close
        MsgBox "Data updated sucessfully"
        End Sub
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top