Export Current record only to Word

G

Guest

Hello,

I have a macro set up that exports data from a query in Access2K to Word
2K...
Currently it is set up to pull ALL records in the query, but I'd prefer it
to export only the record the is currently showing up on the form. Here is
the VB that currently supports the Macro:
Private Sub PrintEnvelope_Click()
On Error GoTo Err_PrintEnvelope_Click

Dim stDocName As String

stDocName = "Client_Print_Envelope"
DoCmd.RunMacro stDocName

Exit_PrintEnvelope_Click:
Exit Sub

Err_PrintEnvelope_Click:
MsgBox Err.Description
Resume Exit_PrintEnvelope_Click

End Sub
 
J

John Nurick

Presumably the Client_Print_Envelope macro gets data from a query to and
sends it to Word.

All you need to do is modify the query so it just returns the current
record displayed by the form. For instance, if your form is called
frmXXX, and the primary key of the table is the field ID, which is bound
to the textbox txtID, put this criterion on the ID field in the query:

=[Forms]![frmXXX]![txtID]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top