Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    3

    Unanswered: Autoamation Object K Error

    Dear friends,

    Would you help me to solve this problem ?

    I've got an error message while I'm debuging my Access VBA. The error message is like this :

    The expression you entered as a query parameter produced this error : 'The object doesn't contain the Automation object 'K."
    I've already search the microsoft support's site but couldn't found the answer.

    This is the codes, the error appear when I put my mouse on rsqrPPhKh!Bulat while I'm in debuging mode. The query (qrPPhKhusus) is OK when I view it, but when I process it with VBA it turns to nightmare

    Private Sub PPhSpesial()
    Dim PPhSetahun

    rsStaff.Open "SELECT * FROM Staff ORDER BY KodeStaff", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    rsqrPPhKh.Open "SELECT * FROM qrPPhKhusus ORDER BY KodeStaff", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    Do While Not rsqrPPhKh.EOF
    If rsqrPPhKh!Bulat <= 0 Then
    PPhSetahun = 0
    ElseIf rsqrPPhKh!Bulat <= 25000000 Then
    PPhSetahun = 0.05 * rsqrPPhKh!Bulat
    ElseIf rsqrPPhKh!Bulat <= 50000000 Then
    PPhSetahun = (0.1 * (rsqrPPhKh!Bulat - 25000000)) + 1250000
    ElseIf rsqrPPhKh!Bulat <= 100000000 Then
    PPhSetahun = (0.15 * (rsqrPPhKh!Bulat - 50000000)) + 3750000
    ElseIf rsqrPPhKh!Bulat <= 200000000 Then
    PPhSetahun = (0.25 * (rsqrPPhKh!Bulat - 100000000)) + 11250000
    Else
    PPhSetahun = (0.35 * (rsqrPPhKh!Bulat - 200000000)) + 36250000
    End If
    rsStaff.Find "KodeStaff = '" & rsqrPPhKh!KodeStaff & "'"
    rsStaff!PPh = Round(PPhSetahun / 12, 2)
    rsStaff.Update
    rsqrPPhKh.MoveNext
    Loop
    rsqrPPhKh.Close
    rsStaff.Close
    End Sub


    Thank you for your kindness

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    It would help to know which line is throwing the error.

    Also, I don't see where you declared and typed your recordset objects in the above code. Don't leave Access to it's own devices when trying to determine what kind of object it's supposed to be working with, be explicit.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Oct 2006
    Posts
    3

    Talking

    dear teddy,

    thank you for your attention, now I've already solve the problem.

Posting Permissions

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