Sajit,
I do not understand the technique you are using but I did a similar task
using a different technique. It did pick the correct template. Here is the
couple of lines I used. It is called from a button on a menu. I hope you
find it useful.
Dennis
============================
Private Sub Command38_Click()
On Error GoTo Err_Command38_Click
'4-13-2007: This loads new world codes exported from the Global Raw Material
Database
'The linked table World Code X-ref must be present and updated
'Mistakes or missing world codes should be fixed in the Global Raws database
(Lotus Notes) and
'all codes then re-imported.
Dim stDocName1, stDocName2, stDocName3, stDocName4 As String
stDocName1 = "qry Delete World Code Lookup List"
stDocName2 = "qry Append German World Codes"
stDocName3 = "qry Append NA World Codes"
stDocName4 = "qry Append UK World Codes"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoCmd.OpenQuery stDocName4, acNormal, acEdit
Exit_Command38_Click:
Exit Sub
Err_Command38_Click:
MsgBox Err.Description
Resume Exit_Command38_Click
End Sub
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Sajit Viswan
Sent: Friday, June 08, 2007 11:18 AM
To: [email protected]
Subject: [Access VBA Central] Report using Unbond OLE frame sourced to Excel
sheet
I am trying to use an Excel file as a template for an Access report.
To do this I have linked the excel file through an unbound OLE frame.
The OLE frame is placed over the report detail area and data controls
are placed over this at locations such that it fills the template
form behind it.
The properties of the frame related to the Excel area as,
Source Doc : C:\sajit\test.xls
Source Item : test1
where test1 is the range name in the Excel sheet.
I also have other sheets which are used as templates for other
reports.
When I preview the report, Access picks the wrong template, even
though the filename and the range name specified in frame properties
are correct.
I have tried giving the reference to the sheet, even though the range
name is unique to the Excel file.
That does not help either.
Sajit
[Non-text portions of this message have been removed]