Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error '13' type not correspondent (2000 sr 1)

    when open this wbook have the error in Object post

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    I don't get an error. Which line of the code is highlighted when you get that error?

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    Into shet rate code

    If Target = "" Then

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    It is strange that this code should run when you open the workbook.

    The error will occur if you modify multiple cells in column M at once. You can change the code as follows:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim oCell As Range
    If Intersect(Range("M3:M65536"), Target) Is Nothing Then Exit Sub
    For Each oCell In Intersect(Range("M3:M65536"), Target)
    If oCell = "" Then
    oCell.Offset(0, -1) = ""
    Cells(oCell.Row, 27) = ""
    Cells(oCell.Row, 35) = ""
    Else
    oCell.Offset(0, -1) = Format(Now, "dd/mm/yyyy")
    Cells(oCell.Row, 27) = [A1]
    Cells(oCell.Row, 35) = "M"
    End If
    Next oCell
    End Sub

    This will handle each modified cell separately.

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    ... Perfect! Now work...
    Tks.

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    Assuming i insert a value into column M when i call this macro to update the RS? and how to delete the realted RS if i calcel a value into column M?


    Sub INPS_TOTALE_MASTER()

    Sheets("RATE").Select

    Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long, N As Long
    Set cn = New ADODB.Connection

    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & gPROVADatabasePath2

    Set rs = New ADODB.Recordset
    rs.Open "INPS_02", cn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    rs.INDEX = "PROVA29"
    r = 3
    Do While Len(Range("A" & r).FORMULA) > 0

    With rs
    If Not rs.BOF Then
    rs.MoveFirst
    End If
    rs.Seek Array(Range("AC" & r)), adSeekFirstEQ
    If rs.EOF = True Then
    .AddNew

    .Fields("PROVA12") = Range("L" & r).Value
    .Fields("PROVA13") = Range("M" & r).Value
    .Fields("PROVA27") = Range("AA" & r).Value
    .Fields("PROVA28") = Range("AB" & r).Value
    .Fields("PROVA29") = Range("AC" & r).Value
    .Fields("PROVA30") = Range("AD" & r).Value

    .Update

    End If
    End With
    r = r + 1
    Loop

    Debug.Print N & " records added."

    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing

    End Sub

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: error '13' type not correspondent (2000 sr 1)

    The INPS_TOTALE_MASTER macro will loop through all filled rows in the RATE sheet. You don't want to do that when you edit a single value.

    It might be possible to update the database from the Worksheet_Change event, but I don't think it would be a good idea, and if I remember correctly, I have already said the same in a similar situation in the past. Keeping the database and the spreadsheet synchronized all the time will cause considerable overhead and might result in conflicts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •