Worked perfect thanks
"Klatuu" wrote:
[Quoted Text] > From the database window, select Queries, Click New. It will ask you what > table or query you want to use for the query. Select the table. Then in the > query builder, select your fields. Use the Criteria row to put your Where > condition in, without the word Where. If you want to reference a control on > your form to pass the SSN, it would look something like: > > Forms!frmMyFormName!WhichSSN > > Read VBA Help on the TransferSpreadsheet method for details on it's syntax. > > To call it, create a command button on your form and put the code for the > TransferSpreadsheet in the Click event. > > "pokdbz" wrote: > > > How do you create a stored query? And then use that to do the export? > > > > "Klatuu" wrote: > > > > > You will want to use the TransferSpreadsheet method. You will find detailed > > > instructions in VBA editor Help. The TransferSpreadsheet method, however, > > > will not accept an SQL string as the Table Name argument. You will need to > > > create a stored query with a parameter for the SSN. If you run this from a > > > form, you can reference the control on the form where the SSN is carried for > > > the parameter value. > > > > > > "pokdbz" wrote: > > > > > > > I have this query: > > > > SELECT PHQ.SSN, PHQ.PHQDate, PHQ.PHQTOT > > > > FROM PHQ > > > > WHERE (((PHQ.SSN)=[whichSSN])); > > > > > > > > > > > > How can I export this to Excel programaticlly?
|