Thanks Iain; This looks good the only thing is that we are using the foxpro Query Wizard in the EXE because they now permit it. But I don't know the name of the file that they are saving it as and how do i access this file to get the select statement from it. The only way that i can think of is the modify command call, but this opens up the edit window which all i want is to access the file contents or is there a another way to do this.