Hi Folks,
I receive a timeout error when attempting to execute code from a command button that the user clicks, the code simply reads criteria from several list boxes that have been selected by the user and uses those elements in a select query to display the total units. If the user selects too many options, the query takes to long to run and therefore the timeout error is rendered. I know how to set the timeout in a typical query, but not through code. If anyone can help, I would greatly appreciate it. Here is some of the code I am using.
*** code:
Dim SQL As String
SQL = "SELECT sum(new_quantity), sum(finalnetamt) from CLAIMSUNION WHERE ((CLAIMSUNION.clmstat)='a' Or (CLAIMSUNION.clmstat)='p') AND ((CLAIMSUNION.procstat)='p' Or (CLAIMSUNION.procstat)='f') AND " & sFY & " and " & sGender & " and " & sRace & " and " & sAdultYouth & " and " & sAODMH & " and " & LOB & sProviders
Set db = CurrentDb
On Error Resume Next
db.QueryDefs.Delete "qryDataType"
On Error GoTo 0
Set qDef = db.createquerydef("qryDataType", SQL)
DoCmd.OpenQuery "qryDataType"
*** end code
Again, code works fine but if user selects too many options, the query takes too long to run and a timeout error is produced.
Thanks
I receive a timeout error when attempting to execute code from a command button that the user clicks, the code simply reads criteria from several list boxes that have been selected by the user and uses those elements in a select query to display the total units. If the user selects too many options, the query takes to long to run and therefore the timeout error is rendered. I know how to set the timeout in a typical query, but not through code. If anyone can help, I would greatly appreciate it. Here is some of the code I am using.
*** code:
Dim SQL As String
SQL = "SELECT sum(new_quantity), sum(finalnetamt) from CLAIMSUNION WHERE ((CLAIMSUNION.clmstat)='a' Or (CLAIMSUNION.clmstat)='p') AND ((CLAIMSUNION.procstat)='p' Or (CLAIMSUNION.procstat)='f') AND " & sFY & " and " & sGender & " and " & sRace & " and " & sAdultYouth & " and " & sAODMH & " and " & LOB & sProviders
Set db = CurrentDb
On Error Resume Next
db.QueryDefs.Delete "qryDataType"
On Error GoTo 0
Set qDef = db.createquerydef("qryDataType", SQL)
DoCmd.OpenQuery "qryDataType"
*** end code
Again, code works fine but if user selects too many options, the query takes too long to run and a timeout error is produced.
Thanks