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()
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
PPhSetahun = (0.35 * (rsqrPPhKh!Bulat - 200000000)) + 36250000
rsStaff.Find "KodeStaff = '" & rsqrPPhKh!KodeStaff & "'"
rsStaff!PPh = Round(PPhSetahun / 12, 2)
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.