I have the following bit of code. I want if possible to be able to pass in the query name (the one in bold) as a variable instead of having it hard coded as shown. Is this possible to do ??I know i can get around it by constructing a querydef with SQL but it would be easier if there was a way of passing the query name instead. i can then make my procedure completely generic.many thanksPaul Private Sub GenerateRankings(strSelectStatement As String, strUpdateStatement As String)On Error GoTo ErrorHandler:''''Generate the rank for each score Dim rstOverall As Recordset, qdfOverall As QueryDef, qdfUpdate As QueryDef Dim rstMainTable As Recordset, qdfMainTable As QueryDef Dim strSQL As String, dblPreviousScore As Double, dblCurrentScore As Double Dim intRank As Integer, intNextRank As Integer, booSame As Boolean Set dbs = CurrentDb Set qdfOverall = dbs.CreateQueryDef("", strSelectStatement) Set rstOverall = qdfOverall.OpenRecordset(dbOpenSnapshot) Set qdfMainTable = dbs.QueryDefs("qryBreakoutByVoterRegion_Overall") Set rstMainTable = qdfMainTable.OpenRecordset(dbOpenDynaset)
Paul