mattaus
06-04-2009, 01:11 AM
:)Hi i need to put a case in or a statement where the user can run all teh options for exampel below the user selects either "Youth Offenders Service" or "Look After Child" and it then runs either of the selections...i would like it to run all the selections one after anither with the user having to select each option one after another??? thanks any help wouuld be grand :):)
please see my code below...
Option Compare Database
Sub Test_Reporta5() 'UniversalEarlyYearsExtendedSchools
Dim AppExcel As Object
Dim LOCReport As Recordset
Dim LOCReport2 As Recordset
Dim CurrentSheet As Variant
Dim SPos As Integer
Dim rpos As Integer
Dim cpos As Integer
Dim i As Integer
Dim j As Integer
Dim count As Integer
Dim datasheet As Variant
Dim Test As Variant
Dim RepType As Integer
Dim Desc As String
Dim StartDate1 As Date
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim EndDate As Date
Dim StartDate As Date
Dim LocC As String
Dim LocL As String
Dim Par1 As Date
Dim Par2 As Date
Dim TeamNo As String
Dim strSql As String
Dim strDateStart As Date
Dim strEndStart As Date
' Stops warnings from appearing
DoCmd.SetWarnings False
' ************************************************** ******************************************
Set AppExcel = CreateObject("excel.application")
AppExcel.Visible = True
' Opens Excel template
'Selects Specialty
Select Case [Forms]![Test]![lstSpecialty]
Case "Look After Child"
AppExcel.Workbooks.Open "S:\SpecialtyActivityReporting\Look After Child.xls", , True
Case "Youth Offenders Service"
AppExcel.Workbooks.Open "S:\SpecialtyActivityReporting\Youth Offenders Service.xls", , True
Case Else
MsgBox "No Valid Specialty selected"
Exit Sub
End Select
please see my code below...
Option Compare Database
Sub Test_Reporta5() 'UniversalEarlyYearsExtendedSchools
Dim AppExcel As Object
Dim LOCReport As Recordset
Dim LOCReport2 As Recordset
Dim CurrentSheet As Variant
Dim SPos As Integer
Dim rpos As Integer
Dim cpos As Integer
Dim i As Integer
Dim j As Integer
Dim count As Integer
Dim datasheet As Variant
Dim Test As Variant
Dim RepType As Integer
Dim Desc As String
Dim StartDate1 As Date
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim EndDate As Date
Dim StartDate As Date
Dim LocC As String
Dim LocL As String
Dim Par1 As Date
Dim Par2 As Date
Dim TeamNo As String
Dim strSql As String
Dim strDateStart As Date
Dim strEndStart As Date
' Stops warnings from appearing
DoCmd.SetWarnings False
' ************************************************** ******************************************
Set AppExcel = CreateObject("excel.application")
AppExcel.Visible = True
' Opens Excel template
'Selects Specialty
Select Case [Forms]![Test]![lstSpecialty]
Case "Look After Child"
AppExcel.Workbooks.Open "S:\SpecialtyActivityReporting\Look After Child.xls", , True
Case "Youth Offenders Service"
AppExcel.Workbooks.Open "S:\SpecialtyActivityReporting\Youth Offenders Service.xls", , True
Case Else
MsgBox "No Valid Specialty selected"
Exit Sub
End Select