Im getting this error: Arguments are of the wrong type, out of range or are in conflict with another Here's my code:

rivate Sub cmdPrintSel_Click()

Call Con("Database.mdb")
    
        RecSet.Open "Select Payroll.EM_ID, Payroll.EM_Name, Payroll.EM_Dep, Payroll.Monthly_Rate, Payroll.dDate, Payroll.xBonus, Payroll.xOT, Payroll.GSIS, Payroll.PH, Payroll.InTax, Payroll.Others, Payroll.absences, Payroll.Advances, Payroll.NetPay " & _
        "From Payroll where EM_ID =" & lvwInfo.SelectedItem.Text & " Group By Payroll.EM_ID, Payroll.EM_Name, Payroll.EM_Dep, Payroll.Monthly_Rate, Payroll.dDate, Payroll.xBonus, Payroll.xOT, Payroll.GSIS, Payroll.PH, Payroll.InTax, Payroll.Others, Payroll.absences, Payroll.Advances, Payroll.NetPay having Month(dDate)='" & Month(dt1.Value) & "' And Day(dDate)='" & Day(Me.dt1.Value) & "' And Year(dDate)='" & Year(dt1.Value) & "' Order By Payroll.EM_ID;", DBLink, adOpenKeyset, adLockPessimistic
    
    Set drtSel.DataSource = RecSet
    drtSel.Show 1
    
RecSet.Close
DBLink.Close

End Sub

Can u tell me where i am getting the error, might be in my database.

Hi! Please visit my code snippet thread.

Easy Code Debugging - prompt_err Function

Then add line number in your code like this.

Private Sub cmdPrintSel_Click()
On Error GoTo errHand

1 Call Con("Database.mdb")
2     
3     RecSet.Open "Select Payroll.EM_ID, Payroll.EM_Name, Payroll.EM_Dep, Payroll.Monthly_Rate, Payroll.dDate, Payroll.xBonus, Payroll.xOT, Payroll.GSIS, Payroll.PH, Payroll.InTax, Payroll.Others, Payroll.absences, Payroll.Advances, Payroll.NetPay From Payroll where EM_ID =" & lvwInfo.SelectedItem.Text & " Group By Payroll.EM_ID, Payroll.EM_Name, Payroll.EM_Dep, Payroll.Monthly_Rate, Payroll.dDate, Payroll.xBonus, Payroll.xOT, Payroll.GSIS, Payroll.PH, Payroll.InTax, Payroll.Others, Payroll.absences, Payroll.Advances, Payroll.NetPay having Month(dDate)='" & Month(dt1.Value) & "' And Day(dDate)='" & Day(Me.dt1.Value) & "' And Year(dDate)='" & Year(dt1.Value) & "' Order By Payroll.EM_ID;", DBLink, adOpenKeyset, adLockPessimistic
4     
5     Set drtSel.DataSource = RecSet
6     drtSel.Show 1
7     
8 RecSet.Close
9 DBLink.Close


Exit Sub
errHand:
   prompt_err Err, "Form1", "Update_Details"

End Sub

I have use the application that I created to add line numbers with the code (It is also attached in my code snippet).

After that, try running it and you can locate the error more easily. Thanks

Thanks for the code snippet, my error was in line 6.

A textbox on my Datareport has a different field name than what is supposed to be.

Great.

This question has already been answered. Start a new discussion instead.