D
Dale C Gray
Hi Albert
I've been following the threads on mail merges and of course have stumbled
across the code you have graciously provided. I almost have it working for
what I need. However in the SQL below I keep getting an "object variable
not set" error. If I replace Me!Lnprn with an actual number i.e. 41 the
code you supplied works as expected. This value is derived from a form at
runtime and the SQL works if pasted into a query?? I only want to merge the
values on the new instance of the form, not all the records in the
table...Can you comment, if I have supplied enough info where
Lnprn=First(autoid).
strSQL = "SELECT tblChemistry.Accession, tblOrders.Received,
tblPatient.PHN," _
& " tblPatient.LastName, tblPatient.FirstName, tblPatient.DOB,
tblPatient.Priority, tblPatient.Sex," _
& " tblPatient.Physician, tblPatient.Phone, tblPatient.Fax,
tblPatient.CollectTime, tblPatient.CallOther" _
& " FROM tblPatient INNER JOIN (tblChemistry INNER JOIN tblOrders ON
tblChemistry.Accession = tblOrders.Accn) ON tblPatient.Nbr = tblOrders.Nbr"
_
& " WHERE ([tblChemistry].[AutoId])>= ([Me]![LnPrn]) "
Me.Refresh
MergeAllWord (strSQL)
I've been following the threads on mail merges and of course have stumbled
across the code you have graciously provided. I almost have it working for
what I need. However in the SQL below I keep getting an "object variable
not set" error. If I replace Me!Lnprn with an actual number i.e. 41 the
code you supplied works as expected. This value is derived from a form at
runtime and the SQL works if pasted into a query?? I only want to merge the
values on the new instance of the form, not all the records in the
table...Can you comment, if I have supplied enough info where
Lnprn=First(autoid).
strSQL = "SELECT tblChemistry.Accession, tblOrders.Received,
tblPatient.PHN," _
& " tblPatient.LastName, tblPatient.FirstName, tblPatient.DOB,
tblPatient.Priority, tblPatient.Sex," _
& " tblPatient.Physician, tblPatient.Phone, tblPatient.Fax,
tblPatient.CollectTime, tblPatient.CallOther" _
& " FROM tblPatient INNER JOIN (tblChemistry INNER JOIN tblOrders ON
tblChemistry.Accession = tblOrders.Accn) ON tblPatient.Nbr = tblOrders.Nbr"
_
& " WHERE ([tblChemistry].[AutoId])>= ([Me]![LnPrn]) "
Me.Refresh
MergeAllWord (strSQL)