Bob and Alan, Thanks for the help. I have gone with the following code and it works!
a = "date(%i,%i,%i)" % (2006,01,31) b = "date(%i,%i,%i)" % (2006,12,31) sql = 'SELECT * FROM times where rt_weekst >= %s and rt_weekst <= %s and rt_type = "%s" ' % (a,b,"R",) db = mx.ODBC.Windows.DriverConnect('DSN=tnt') c = db.cursor() c.execute(sql) As you rightly pointed out, I needed to get my sql string formatted and working before putting it anywhere near the c.execute command. Many thanks, John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor