The following is a section of code taken from an A97 database, which I did not create. The purpose of this code is to auto-populate an Excel template with information from Access.
Function PopulateFormFields(strTemplate As String, strPledgee As String, strCustodian As String, strLoc As String) As Boolean
Dim rsTemplateField, rsVariable, rsLookup As Recordset
Dim intIndex, I as Integer
Dim MyFileObj As FileSystemObject
Dim MyFile As TextStream
Dim rs As Recordset
On Error GoTo PopulateFormFields_Err
[color=Green]' Select all fields to be substituted for this Excel template (fields to be inserted will be processed later)[/color]
Set rsTemplateField = CurrentDb.OpenRecordset("SELECT * FROM tblTemplateField WHERE FormName = '"_ & strTemplate & "' AND (InsertCoordinates = Null or InsertCoordinates < 'A1')")
If rsTemplateField.EOF Then
MsgBox "No fields found in template field table for form " & strTemplate & ". Generation of form " & strTemplate & " aborted."
PopulateFormFields = False
The section that begins "Set rsTemplateField" is where this hangs up in A2007. Did some of the VBA language change frmo 97 to 07?
Alternatively, is there an issue with the Excel template being Excel 97-03 instead of 07?