[AccessD] Help!Why won't this work?

Klos, Susan Susan.Klos at fldoe.org
Tue Jun 10 08:28:03 CDT 2003


It worked yesterday.
'------------------------------------------------------------
' mcrSaveReading
'
'------------------------------------------------------------
Function mcrSaveReading()
On Error GoTo mcrSaveReading_Err

    Dim school As String
    Dim strFileName As String
    Dim mysql As String
    Dim qdf As QueryDef
    Dim db As Database
    Dim rs As DAO.Recordset
       
    Set db = CurrentDb
        
    Set rs = db.OpenRecordset("GradedSchools")
    Do Until (rs.EOF)
   school = rs.Fields("DistSchNo")
    'school = InputBox("What School Number")
    'school = "[GradedSchools.DistSchNo]"
    'MsgBox school
    'DoCmd.TransferSpreadsheet acExport, 8, "Reading",
"T:\2002-2003\SchoolGrades\Data\Reading" & school & ".xls", True, ""
    mysql = "SELECT ReadingGrade.DistSchNo, ReadingGrade.Grade,
ReadingGrade.LName, ReadingGrade.FName, " & _
    "ReadingGrade.IDSS, ReadingGrade.Curr03, ReadingGrade.MatchFCAT02,
ReadingGrade.LevelR03, " & _
    "ReadingGrade.LevelR02, ReadingGrade.DSS03R, ReadingGrade.DSSR02,
ReadingGrade.SSR02, ReadingGrade.Lo25 FROM ReadingGrade " & _
    "WHERE (((ReadingGrade.DistSchNo)='" & school & "'))"

    Set qdf = db.QueryDefs("Reading")
     
     strFileName = "T:\2002-2003\SchoolGrades\Data\Reading" & school &
".xls"
     qdf.SQL = mysql
    'MsgBox "tablename = " & strFileName
     
     DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, qdf.Name,
strFileName, True
     rs.MoveNext
    Loop
    
mcrSaveReading_Exit:
    Exit Function

mcrSaveReading_Err:
    MsgBox Error$
    Resume mcrSaveReading_Exit

End Function


More information about the AccessD mailing list