Home

 


"No Document is currently open in the Acrobat Viewer."

1


Solution:

Set AcroApp = CreateObject("AcroExch.App")
Set avDoc = CreateObject("AcroExch.AVDoc")
'

bOk = False

bOk = avDoc.Open(CurrentProject.Path & "\t2202a.pdf", "")
AcroApp.Show

Set pddoc = avDoc.GetPDDoc
bOk = pddoc.Save(1, TaxFormPath & "\t2202a.pdf")

 


 

Option Compare Database
Option Explicit

Public FP As String

Public TaxFormPath As String

Public OnlyOne As Boolean

Public AcroApp As Object 'As Acrobat.CAcroApp
Public avDoc As Object 'CAcroAVDoc
Public pddoc As Object 'Acrobat.CAcroPDDoc
Public bOk As Boolean

'Public field As Object 'AFORMAUTLib.field
'Public formApp As Object 'AFORMAUTLib.AFormApp
'Public fields As Object 'AFORMAUTLib.Fields

Function T2202AForm(ByRef Arr() As String)
Dim NN As Integer
Dim NameProg1, StuNumb1, NameAddress As String
Dim year1, month1, year5, month5, EligTFees1, B1, C1 As String
Dim year2, month2, year6, month6, EligTFees2, B2, C2 As String
Dim year3, month3, year7, month7, EligTFees3, B3, C3 As String
Dim year4, month4, year8, month8, EligTFees4, B4, C4 As String
Dim Total1, TotalB1, TotalC1, Address1 As String

Dim FName, LName, Addr1, Addr2, City, Province, Zipcode, Country As String

FName = Arr(0)
LName = Arr(1)
Addr1 = Arr(2)
Addr2 = Arr(3)
City = Arr(4)
Province = Arr(5)
Zipcode = Arr(6)
Country = Arr(7)

NameProg1 = Arr(8)

StuNumb1 = Arr(9)

NameAddress = Chr(13) & FName & " " & LName & Chr(13) & _
Addr1 & " " & Addr2 & Chr(13) & _
City & "," & Province & Zipcode & _
Country

year1 = Arr(10)
month1 = Arr(11)
year5 = Arr(12)
month5 = Arr(13)
EligTFees1 = Arr(14)
B1 = Arr(15)
C1 = Arr(16)

year2 = Arr(17)
month2 = Arr(18)
year6 = Arr(19)
month6 = Arr(20)
EligTFees2 = Arr(21)
B2 = Arr(22)
C2 = Arr(23)

year3 = Arr(24)
month3 = Arr(25)
year7 = Arr(26)
month7 = Arr(27)
EligTFees3 = Arr(28)
B3 = Arr(29)
C3 = Arr(30)

 

year4 = Arr(31)
month4 = Arr(32)
year8 = Arr(33)
month8 = Arr(34)
EligTFees4 = Arr(35)
B4 = Arr(36)
C4 = Arr(37)

Total1 = Arr(38)
TotalB1 = Arr(39)
TotalC1 = Arr(40)

Address1 = Arr(41)
'
'Dim AcroApp As Object 'As Acrobat.CAcroApp
'Dim avDoc As Object 'CAcroAVDoc
Dim field As AFORMAUTLib.field
Dim formApp As AFORMAUTLib.AFormApp
Dim fields As AFORMAUTLib.fields

Set pddoc = avDoc.GetPDDoc

bOk = pddoc.Save(1, TaxFormPath & FName & "_" & LName & StuNumb1 & ".pdf")

Set avDoc = AcroApp.GetActiveDoc

Set formApp = CreateObject("AFormAut.App")
Set fields = formApp.fields
Dim fieldname, fieldvalue

For Each field In fields

fieldname = field.Name
Select Case fieldname
Case "NameProg1"
field.Value = NameProg1
Case "StuNumb1"
field.Value = StuNumb1
Case "NameAddress"
field.Value = NameAddress

Case "year1"
field.Value = year1
Case "month1"
field.Value = month1
Case "year5"
field.Value = year5
Case "month5"
field.Value = month5
Case "EligTFees1"
field.Value = EligTFees1
Case "B1"
field.Value = B1
Case "C1"
field.Value = C1

Case "year2"
field.Value = year2
Case "month2"
field.Value = month2
Case "year6"
field.Value = year6
Case "month6"
field.Value = month6
Case "EligTFees2"
field.Value = EligTFees2
Case "B2"
field.Value = B2
Case "C2"
field.Value = C2

Case "year3"
field.Value = year3
Case "month3"
field.Value = month3
Case "year7"
field.Value = year7
Case "month7"
field.Value = month7
Case "EligTFees3"
field.Value = EligTFees3
Case "B3"
field.Value = B3
Case "C3"
field.Value = C3

Case "year4"
field.Value = year4
Case "month4"
field.Value = month4
Case "year8"
field.Value = year8
Case "month8"
field.Value = month8
Case "EligTFees4"
field.Value = EligTFees4
Case "B4"
field.Value = B4
Case "C4"
field.Value = C4

Case "Total1"
field.Value = Total1
Case "TotalB1"
field.Value = TotalB1
Case "TotalC1"
field.Value = TotalC1

Case "Address1"

field.Value = Address1

End Select


Next field

bOk = pddoc.Save(1, TaxFormPath & FName & "_" & LName & StuNumb1 & ".pdf")
'after setting the default printer to adobe pdf,a readonly tax form will be created.
If OnlyOne Then
Set avDoc = AcroApp.GetActiveDoc
avDoc.PrintPages 0, 1, 2, True, False
End If

'avDoc.Close

'AcroApp.CloseAllDocs

'
'Set AcroApp = Nothing
'Set avDoc = Nothing
Set field = Nothing
Set fields = Nothing
'

End Function

 

Private Sub cmdCreateTaxForm_Click()

Dim strSQL1 As String
Dim rst1 As Recordset

OnlyOne = True

strSQL1 = "SELECT tblpayment.StudentId, Sum(tblpayment.PayAmount) " & _
" AS SumOfPayAmount FROM tblpayment WHERE (((tblpayment.Paytype)<>'SC') AND ((tblpayment.Register)=No)) AND " & _
" ((tblpayment.StudentID='" & Stu_ID & "')) GROUP BY tblpayment.StudentId "

Set rst1 = CurrentDb.OpenRecordset(strSQL1)
If rst1.RecordCount = 0 Then
MsgBox "No payment collected!"
Exit Sub
End If

If rst1("SumOfPayAmount") <= 0 Then
MsgBox "No payment collected!"
Exit Sub
End If


Dim rst As Recordset
Dim strSQL As String

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName, tblStudents.SDate, tblStudents.EDate as StudentEndDate, " & _
"tblStudents.Addr1, tblStudents.Addr2, tblStudents.City, tblStudents.State, tblStudents.Zipcode, tblStudents.Country,tblstudents.tuition,tblPrograms.ProgramName, " & _
" tblPrograms.FullPartTime FROM tblPrograms INNER JOIN tblStudents " & _
" ON tblPrograms.ProgramID=tblStudents.ProgramID" & _
" WHERE ((tblStudents.StudentID)='" & Stu_ID & "')"

 

Set rst = CurrentDb.OpenRecordset(strSQL)

If Year(rst("SDate")) <> taxYear.Value Then
If Year(rst("StudentEndDate")) <> taxYear.Value Then
MsgBox ("No tax form generated for " & rst("FName") & " " & rst("LName") & " of year '" & taxYear.Value & "'")
Exit Sub
End If
End If

'within the tax year
Dim Arr(0 To 41) As String
Dim i As Integer
For i = 0 To 41
Arr(i) = ""
Next i

Dim TaxEstimate, MonthTuition, programMonth1, programMonth2, ProgramMonth

'Program Month
If Year(rst("StudentEndDate")) > Year(rst("SDate")) Then 'cross year
programMonth1 = 12 - Month(rst("SDate"))
If Month(rst("StudentEndDate")) = Month(rst("SDate")) Then
programMonth2 = Month(rst("StudentEndDate"))
Else
programMonth2 = 1 + Month(rst("StudentEndDate"))
End If
ProgramMonth = programMonth1 + programMonth2

Else 'same year
ProgramMonth = Month(rst("StudentEndDate")) - Month(rst("SDate")) + 1
End If

Dim TaxStartMonth, TaxEndMonth

If Year(rst("SDate")) = taxYear.Value Then
'Tax Start Month
TaxStartMonth = Month(rst("SDate"))
If Year(rst("StudentEndDate")) = taxYear.Value Then
'same year program
TaxEndMonth = Month(rst("StudentEndDate"))
Else
'cross year program
TaxEndMonth = 12
End If

Else
TaxStartMonth = 1
'start month and end month are same
If Month(rst("SDate")) = Month(rst("StudentEndDate")) Then
TaxEndMonth = Month(rst("StudentEndDate")) - 1
Else
TaxEndMonth = Month(rst("StudentEndDate"))
End If
End If

MonthTuition = rst("Tuition") / ProgramMonth

TaxEstimate = Round((TaxEndMonth - TaxStartMonth + 1) * MonthTuition, 0)

Dim TaxActual
If taxYear.Value > Year(rst("SDate")) Then 'second year
If TaxEstimate > rst1("SumOfPayAmount") - (12 - Month(rst("SDate")) + 1) * MonthTuition Then
TaxActual = rst1("SumOfPayAmount") - (12 - Month(rst("SDate")) + 1) * MonthTuition
Else
TaxActual = TaxEstimate
End If
Else 'first year
If TaxEstimate > rst1("SumOfPayAmount") Then
TaxActual = rst1("SumOfPayAmount")
Else
TaxActual = TaxEstimate
End If
End If

Arr(0) = IIf(IsNull(rst("FName")), "", rst("FName"))
Arr(1) = IIf(IsNull(rst("lName")), "", rst("lName"))
Arr(2) = IIf(IsNull(rst("Addr1")), "", rst("Addr1"))
Arr(3) = IIf(IsNull(rst("Addr2")), "", rst("Addr2"))
Arr(4) = IIf(IsNull(rst("City")), "", rst("City"))
Arr(5) = IIf(IsNull(rst("State")), "", rst("State"))
Arr(6) = IIf(IsNull(rst("zipcode")), "", rst("zipcode"))
Arr(7) = IIf(IsNull(rst("Country")), "", rst("Country"))
Arr(8) = IIf(IsNull(rst("ProgramName")), "", rst("ProgramName"))
Arr(9) = IIf(IsNull(rst("StudentID")), "", rst("StudentID"))
Arr(10) = taxYear.Value
Arr(12) = taxYear.Value

Arr(11) = TaxStartMonth
Arr(13) = TaxEndMonth


If rst("FullPartTime") = "F" Then
'Full Time students
Arr(16) = Arr(13) - Arr(11) + 1
Arr(40) = Arr(16)

Else
'Part time students
Arr(15) = Arr(13) - Arr(11) + 1
Arr(39) = Arr(15)
End If

Arr(14) = TaxActual
Arr(38) = Arr(14)

Arr(39) = Arr(15)

Arr(41) = "Vancouver Institute of Media Arts" & Chr(13) & "600-570 Dunsmuir St. Vancouver, BC V6B 1Y1 Canada"

TaxFormPath = "c:\taxform\"

T2202AForm Arr:=Arr
MsgBox ("Tax form is created!")

nEND:
' Dim strAcrobat As String
' strAcrobat = "TaskKill /F /IM Acrobat.exe"
' Call Shell("cmd /K" & strAcrobat, vbNormalNoFocus)

End Sub

Private Sub cmdFind_Click()

Dim t1, t2
Dim strSQL As String

t1 = Trim(Me.Controls("txtFirstName"))
t2 = Trim(Me.Controls("txtlastname"))

If t1 = "" And t2 = "" Then
Exit Sub
End If

Dim vLName, vFName As String
vLName = Trim(IIf(IsNull(Forms!frmTax!txtLastName), "", Forms!frmTax!txtLastName))
vFName = Trim(IIf(IsNull(Forms!frmTax!txtFirstName), "", Forms!frmTax!txtFirstName))

Dim h1, h2 As String

Dim position As Integer


position = InStr(1, vFName, "'")
If position >= 1 Then
h1 = Left(vFName, position - 1)
h2 = Right(vFName, Len(vFName) - position)
vFName = h1 + "''" + h2
End If


position = InStr(1, vLName, "'")
If position >= 1 Then
h1 = Left(vLName, position - 1)
h2 = Right(vLName, Len(vLName) - position)
vLName = h1 + "''" + h2
End If

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName, tblStudents.SDate,tblStudents.EDate,tblPrograms.ProgramName, IIf([Origin]='D',[DTuition],[ITuition]) AS Tuition" & _
" FROM tblPrograms INNER JOIN tblStudents ON tblPrograms.ProgramID = tblStudents.ProgramID" & _
" Where tblStudents.LName Like '" & vLName & "*'" & " and (Year(tblStudents.SDate)='" & taxYear.Value & "' or year(tblStudents.Edate)='" & taxYear.Value & "')" & _
" and (((tblStudents.SDate) Is Not Null)) and tblStudents.Origin='D'"

 

 

If t1 = "" And t2 <> "" Then

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.SDate,tblStudents.EDate,tblStudents.LName, tblPrograms.ProgramName, IIf([Origin]='D',[DTuition],[ITuition]) AS Tuition" & _
" FROM tblPrograms INNER JOIN tblStudents ON tblPrograms.ProgramID = tblStudents.ProgramID" & _
" Where tblStudents.LName Like '" & vLName & "*'" & " and (Year(tblStudents.SDate)='" & taxYear.Value & "' or year(tblStudents.Edate)='" & taxYear.Value & "')" & _
" and (((tblStudents.SDate) Is Not Null)) and tblStudents.Origin='D'"

'trSQL = "SELECT StudentID, FName, LName,origin FROM tblStudents WHERE (((tblstudents.LName) like '" & Forms!frmsearchStudent!txtLastName & "*'))"
GoTo tt
End If

If t1 <> "" And t2 = "" Then

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName,tblStudents.SDate,tblStudents.EDate, tblPrograms.ProgramName, IIf([Origin]='D',[DTuition],[ITuition]) AS Tuition" & _
" FROM tblPrograms INNER JOIN tblStudents ON tblPrograms.ProgramID = tblStudents.ProgramID" & _
" Where tblStudents.FName Like '" & vFName & "*'" & " and (Year(tblStudents.SDate)='" & taxYear.Value & "' or year(tblStudents.Edate)='" & taxYear.Value & "')" & _
" and (((tblStudents.SDate) Is Not Null)) and tblStudents.Origin='D'"

'strSQL = "SELECT StudentID, FName, LName,origin FROM tblStudents WHERE (((tblstudents.FName) like '" & Forms!frmsearchStudent!txtFirstName & "*'))"
GoTo tt
End If

If t1 <> "" And t2 <> "" Then

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName,tblStudents.SDate,tblStudents.EDate, tblPrograms.ProgramName, IIf([Origin]='D',[DTuition],[ITuition]) AS Tuition" & _
" FROM tblPrograms INNER JOIN tblStudents ON tblPrograms.ProgramID = tblStudents.ProgramID" & _
" Where tblStudents.LName Like '" & vLName & "*' and tblStudents.FName Like '" & vFName & "*'" & " and (Year(tblStudents.SDate)='" & taxYear.Value & "' or year(tblStudents.Edate)='" & taxYear.Value & "')" & _
" and (((tblStudents.SDate) Is Not Null)) and tblStudents.Origin='D'"

 

End If

tt:

Dim frm As Form, ctl As Control, sfrm As Form

Set frm = Forms("frmTax")
Set ctl = frm.Controls("frmTaxSubform")
Set sfrm = ctl.Form

sfrm.RecordSource = strSQL

sfrm.Requery

End Sub

Private Sub cmdPrintAll_Click()

Dim rst As Recordset
Dim strSQL As String

Select Case Me.Frame17
Case "1"

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName, tblStudents.SDate, tblStudents.EDate AS StudentEndDate, " & _
"tblStudents.Addr1, tblStudents.Addr2, tblStudents.City, tblStudents.State, tblStudents.Zipcode, tblStudents.Country,tblPrograms.ProgramName, " & _
"qryTaxPayAmount.SumOfPayAmount, IIf((Year([tblStudents].[EDate])>Year([tblStudents].[SDate])), " & _
" ((12-Month([tblStudents].[SDate])+(IIf(Month([tblStudents].[SDate])=Month([tblstudents].[EDate]),0,1)))+" & _
" Month([tblStudents].[EDate])),(Month([tblStudents].[EDate])-Month([tblStudents].[SDate])+1)) AS ProgramMonth, " & _
" Format(([tblStudents].[Tuition]/[ProgramMonth]),'Currency') AS MonthTuition, IIf(Year([tblStudents].[SDate])=" & _
taxYear.Value & ",Month([tblStudents].[Sdate]),1) AS TaxStartMonth, " & _
" IIf(Year([tblStudents].[SDate])=" & taxYear.Value & ",IIf(" & taxYear.Value & _
" =Year([tblStudents].[EDate]),Month([tblStudents].[Edate]),12),IIf(Month([tblstudents].[Sdate])=" & _
" Month([tblstudents].[edate]),(Month([tblstudents].[Sdate])-1),Month([tblstudents].[EDate]))) " & _
" AS TaxEndMonth, Round(([TaxEndMonth]-[TaxStartMonth]+1)*[MonthTuition],0) AS TaxEstimate, " & _
" IIf((" & taxYear.Value & ") >Year([tblStudents].[SDate]),(IIf([TaxEstimate]>" & _
" ([SumOfPayAmount]-(12-Month([tblStudents].[SDate])+1)*[MonthTuition]),([SumOfPayAmount]" & _
" -(12-Month([tblStudents].[SDate])+1)*[MonthTuition]),[TaxEstimate])),(IIf([TaxEstimate]>" & _
" [SumOfPayAmount],[SumOfPayAmount],[TaxEstimate]))) AS TaxActual, tblStudents.Origin " & _
" FROM tblPrograms INNER JOIN (tblStudents INNER JOIN (SELECT tblpayment.StudentId, Sum(tblpayment.PayAmount) " & _
" AS SumOfPayAmount FROM tblpayment WHERE (((tblpayment.Paytype)<>'SC') AND ((tblpayment.Register)=No)) " & _
" GROUP BY tblpayment.StudentId) as qryTaxPayAmount ON tblStudents.StudentID=qryTaxPayAmount.StudentId) ON " & _
" tblPrograms.ProgramID=tblStudents.ProgramID" & _
" WHERE (((tblPrograms.FullPartTime)='f') And ((qryTaxPayAmount.SumOfPayAmount)>0) " & _
" And ((IIf((Year(tblStudents.EDate)>Year(tblStudents.SDate)),((12-Month(tblStudents.SDate)" & _
" +(IIf(Month(tblStudents.SDate)=Month(tblstudents.EDate),0,1)))+Month(tblStudents.EDate))," & _
" (Month(tblStudents.EDate)-Month(tblStudents.SDate)+1)))>1) And ((tblStudents.Origin)='D') " & _
" And ((" & taxYear.Value & ")=Year(tblStudents.SDate) Or (" & taxYear.Value & ")=Year(tblStudents.EDate)))"

 

Set rst = CurrentDb.OpenRecordset(strSQL)



Case "2" 'Part Time

strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName, tblStudents.SDate, tblStudents.EDate AS StudentEndDate, " & _
"tblStudents.Addr1, tblStudents.Addr2, tblStudents.City, tblStudents.State, tblStudents.Zipcode, tblStudents.Country,tblPrograms.ProgramName, " & _
"qryTaxPayAmount.SumOfPayAmount, IIf((Year([tblStudents].[EDate])>Year([tblStudents].[SDate])), " & _
" ((12-Month([tblStudents].[SDate])+(IIf(Month([tblStudents].[SDate])=Month([tblstudents].[EDate]),0,1)))+" & _
" Month([tblStudents].[EDate])),(Month([tblStudents].[EDate])-Month([tblStudents].[SDate])+1)) AS ProgramMonth, " & _
" Format(([tblStudents].[Tuition]/[ProgramMonth]),'Currency') AS MonthTuition, IIf(Year([tblStudents].[SDate])=" & _
taxYear.Value & ",Month([tblStudents].[Sdate]),1) AS TaxStartMonth, " & _
" IIf(Year([tblStudents].[SDate])=" & taxYear.Value & ",IIf(" & taxYear.Value & _
" =Year([tblStudents].[EDate]),Month([tblStudents].[Edate]),12),IIf(Month([tblstudents].[Sdate])=" & _
" Month([tblstudents].[edate]),(Month([tblstudents].[Sdate])-1),Month([tblstudents].[EDate]))) " & _
" AS TaxEndMonth, Round(([TaxEndMonth]-[TaxStartMonth]+1)*[MonthTuition],0) AS TaxEstimate, " & _
" IIf((" & taxYear.Value & ") >Year([tblStudents].[SDate]),(IIf([TaxEstimate]>" & _
" ([SumOfPayAmount]-(12-Month([tblStudents].[SDate])+1)*[MonthTuition]),([SumOfPayAmount]" & _
" -(12-Month([tblStudents].[SDate])+1)*[MonthTuition]),[TaxEstimate])),(IIf([TaxEstimate]>" & _
" [SumOfPayAmount],[SumOfPayAmount],[TaxEstimate]))) AS TaxActual, tblStudents.Origin " & _
" FROM tblPrograms INNER JOIN (tblStudents INNER JOIN (SELECT tblpayment.StudentId, Sum(tblpayment.PayAmount) " & _
" AS SumOfPayAmount FROM tblpayment WHERE (((tblpayment.Paytype)<>'SC') AND ((tblpayment.Register)=No)) " & _
" GROUP BY tblpayment.StudentId) as qryTaxPayAmount ON tblStudents.StudentID=qryTaxPayAmount.StudentId) ON " & _
" tblPrograms.ProgramID=tblStudents.ProgramID" & _
" WHERE (((tblPrograms.FullPartTime)='p') And ((qryTaxPayAmount.SumOfPayAmount)>0) " & _
" And ((IIf((Year(tblStudents.EDate)>Year(tblStudents.SDate)),((12-Month(tblStudents.SDate)" & _
" +(IIf(Month(tblStudents.SDate)=Month(tblstudents.EDate),0,1)))+Month(tblStudents.EDate))," & _
" (Month(tblStudents.EDate)-Month(tblStudents.SDate)+1)))>=1) And ((tblStudents.Origin)='D') " & _
" And ((" & taxYear.Value & ")=Year(tblStudents.SDate) Or (" & taxYear.Value & ")=Year(tblStudents.EDate)))"

 

Set rst = CurrentDb.OpenRecordset(strSQL)


End Select

Dim Arr(0 To 41) As String
Dim i As Integer
For i = 0 To 41
Arr(i) = ""
Next i

If rst.RecordCount > 0 Then
rst.MoveFirst
End If

Dim ii As Integer
ii = 0

Do While Not rst.EOF
'ii = ii + 1
'If ii = 6 Then GoTo nEND

Arr(0) = IIf(IsNull(rst("FName")), "", rst("FName"))
Arr(1) = IIf(IsNull(rst("lName")), "", rst("lName"))
Arr(2) = IIf(IsNull(rst("Addr1")), "", rst("Addr1"))
Arr(3) = IIf(IsNull(rst("Addr2")), "", rst("Addr2"))
Arr(4) = IIf(IsNull(rst("City")), "", rst("City"))
Arr(5) = IIf(IsNull(rst("State")), "", rst("State"))
Arr(6) = IIf(IsNull(rst("zipcode")), "", rst("zipcode"))
Arr(7) = IIf(IsNull(rst("Country")), "", rst("Country"))
Arr(8) = IIf(IsNull(rst("ProgramName")), "", rst("ProgramName"))
Arr(9) = IIf(IsNull(rst("StudentID")), "", rst("StudentID"))

Arr(10) = taxYear.Value
Arr(11) = IIf(IsNull(rst("TaxStartMonth")), "", rst("TaxStartMonth"))

Arr(12) = taxYear.Value
Arr(13) = IIf(IsNull(rst("TaxEndMonth")), "", rst("TaxEndMonth"))

Arr(14) = IIf(IsNull(rst("TaxActual")), "", rst("TaxActual"))
Arr(38) = Arr(14)

Select Case Me.Frame17
Case "1"

Arr(16) = Arr(13) - Arr(11) + 1

Arr(40) = Arr(16)

Case "2"

Arr(15) = Arr(13) - Arr(11) + 1
Arr(39) = Arr(15)
End Select

Arr(41) = "Vancouver Institute of Media Arts" & Chr(13) & "600-570 Dunsmuir St. Vancouver, BC V6B 1Y1 Canada"
rst.MoveNext
T2202AForm Arr:=Arr

 

Loop

nEND:
' Dim strAcrobat As String
' strAcrobat = "TaskKill /F /IM Acrobat.exe"
' Call Shell("cmd /K" & strAcrobat, vbNormalNoFocus)
MsgBox ("Tax Forms have been created! Please print them!")

End Sub

'Private Sub cmdPrintForm_Click()
'
'Dim strSQL1 As String
'Dim rst1 As Recordset
'
'
'
'
'strSQL1 = "SELECT tblpayment.StudentId, Sum(tblpayment.PayAmount) " & _
'" AS SumOfPayAmount FROM tblpayment WHERE (((tblpayment.Paytype)<>'SC') AND ((tblpayment.Register)=No)) AND " & _
'" ((tblpayment.StudentID='" & Stu_ID & "')) GROUP BY tblpayment.StudentId "
'
'
' Set rst1 = CurrentDb.OpenRecordset(strSQL1)
' If rst1.RecordCount = 0 Then
' MsgBox "No payment collected!"
' Exit Sub
'End If
'
' If rst1("SumOfPayAmount") <= 0 Then
' MsgBox "No payment collected!"
' Exit Sub
' End If
'
'
'Dim rst As Recordset
'Dim strSQL As String
'
'
'strSQL = "SELECT tblStudents.StudentID, tblStudents.FName, tblStudents.LName, tblStudents.SDate, tblStudents.EDate as StudentEndDate, " & _
'"tblStudents.Addr1, tblStudents.Addr2, tblStudents.City, tblStudents.State, tblStudents.Zipcode, tblStudents.Country,tblstudents.tuition,tblPrograms.ProgramName, " & _
'" tblPrograms.FullPartTime FROM tblPrograms INNER JOIN tblStudents " & _
'" ON tblPrograms.ProgramID=tblStudents.ProgramID" & _
'" WHERE ((tblStudents.StudentID)='" & Stu_ID & "')"
'
'
'
' Set rst = CurrentDb.OpenRecordset(strSQL)
'
' If Year(rst("SDate")) <> taxYear.Value Then
' If Year(rst("StudentEndDate")) <> taxYear.Value Then
' MsgBox ("No tax form generated for " & rst("FName") & " " & rst("LName") & " of year '" & taxYear.Value & "'")
' Exit Sub
' End If
' End If
'
''within the tax year
'Dim Arr(0 To 41) As String
'Dim i As Integer
'For i = 0 To 41
'Arr(i) = ""
'Next i
'
'
'Dim taxEstimate, MonthTuition, programMonth1, programMonth2, programMonth
'
''Program Month
'If Year(rst("StudentEndDate")) > Year(rst("SDate")) Then 'cross year
' programMonth1 = 12 - Month(rst("SDate"))
' If Month(rst("StudentEndDate")) = Month(rst("SDate")) Then
' programMonth2 = Month(rst("StudentEndDate"))
' Else
' programMonth2 = 1 + Month(rst("StudentEndDate"))
' End If
' programMonth = programMonth1 + programMonth2
'
'Else 'same year
'programMonth = Month(rst("StudentEndDate")) - Month(rst("SDate")) + 1
'End If
'
'
'
'Dim taxStartMonth, taxEndMonth
'
'If Year(rst("SDate")) = taxYear.Value Then
' 'Tax Start Month
' taxStartMonth = Month(rst("SDate"))
' If Year(rst("StudentEndDate")) = taxYear.Value Then
' 'same year program
' taxEndMonth = Month(rst("StudentEndDate"))
' Else
' 'cross year program
' taxEndMonth = 12
' End If
'
'Else
' taxStartMonth = 1
' 'start month and end month are same
' If Month(rst("SDate")) = Month(rst("StudentEndDate")) Then
' taxEndMonth = Month(rst("StudentEndDate")) - 1
' Else
' taxEndMonth = Month(rst("StudentEndDate"))
' End If
'End If
'
'MonthTuition = rst("Tuition") / programMonth
'
'taxEstimate = Round((taxEndMonth - taxStartMonth + 1) * MonthTuition, 0)
'
'Dim taxActual
'If taxYear.Value > Year(rst("SDate")) Then 'second year
' If taxEstimate > rst1("SumOfPayAmount") - (12 - Month(rst("SDate")) + 1) * MonthTuition Then
' taxActual = rst1("SumOfPayAmount") - (12 - Month(rst("SDate")) + 1) * MonthTuition
' Else
' taxActual = taxEstimate
' End If
'Else 'first year
' If taxEstimate > rst1("SumOfPayAmount") Then
' taxActual = rst1("SumOfPayAmount")
' Else
' taxActual = taxEstimate
' End If
'End If
'
'
' Arr(0) = IIf(IsNull(rst("FName")), "", rst("FName"))
' Arr(1) = IIf(IsNull(rst("lName")), "", rst("lName"))
' Arr(2) = IIf(IsNull(rst("Addr1")), "", rst("Addr1"))
' Arr(3) = IIf(IsNull(rst("Addr2")), "", rst("Addr2"))
' Arr(4) = IIf(IsNull(rst("City")), "", rst("City"))
' Arr(5) = IIf(IsNull(rst("State")), "", rst("State"))
' Arr(6) = IIf(IsNull(rst("zipcode")), "", rst("zipcode"))
' Arr(7) = IIf(IsNull(rst("Country")), "", rst("Country"))
' Arr(8) = IIf(IsNull(rst("ProgramName")), "", rst("ProgramName"))
' Arr(9) = IIf(IsNull(rst("StudentID")), "", rst("StudentID"))
' Arr(10) = taxYear.Value
' Arr(12) = taxYear.Value
'
' Arr(11) = taxStartMonth
' Arr(13) = taxEndMonth
'
'
' If rst("FullPartTime") = "F" Then
' 'Full Time students
' Arr(16) = Arr(13) - Arr(11) + 1
' Arr(40) = Arr(16)
'
' Else
' 'Part time students
' Arr(15) = Arr(13) - Arr(11) + 1
' Arr(39) = Arr(15)
' End If
'
'
'Arr(14) = taxActual
'Arr(38) = Arr(14)
'
'Arr(39) = Arr(15)
'
'
'Arr(41) = "Vancouver Institute of Media Arts" & Chr(13) & "600-570 Dunsmuir St. Vancouver, BC V6B 1Y1 Canada"
'
'
'
'
'End Sub

Private Sub Form_Open(Cancel As Integer)
Stu_ID = ""

taxYear.Value = Year(Now)

On Error Resume Next

MkDir ("C:\TaxForm")

MkDir ("C:\TaxForm\FullTimeStudents")

MkDir ("C:\TaxForm\PartTimeStudents")

On Error GoTo 0

Select Case Me.Frame17
Case "1"
cmdPrintAll.Caption = "Create Tax Form(Full Time)"
FP = "F"
TaxFormPath = "C:\TaxForm\FullTimeStudents\"

Case "2"
cmdPrintAll.Caption = "Create Tax Form(Part Time)"
FP = "P"
TaxFormPath = "C:\TaxForm\PartTimeStudents\"
End Select

Set AcroApp = CreateObject("AcroExch.App")
Set avDoc = CreateObject("AcroExch.AVDoc")
'

bOk = False

bOk = avDoc.Open(CurrentProject.Path & "\t2202a.pdf", "")
AcroApp.Show

Set pddoc = avDoc.GetPDDoc
bOk = pddoc.Save(1, TaxFormPath & "\t2202a.pdf")

Dim frm As Form, ctl As Control, sfrm As Form

Set frm = Forms("frmTax")
Set ctl = frm.Controls("frmTaxSubform")
Set sfrm = ctl.Form

Me.Controls("txtFirstName") = ""
Me.Controls("txtLastName") = ""

Dim strSQL As String

strSQL = "SELECT StudentID, FName, LName FROM tblStudents where FName='zzzzzzz'"

sfrm.RecordSource = strSQL

sfrm.Requery

OnlyOne = False

End Sub

Private Sub Form_Unload(Cancel As Integer)
Set AcroApp = Nothing
Set avDoc = Nothing

End Sub

Private Sub Option20_GotFocus()
cmdPrintAll.Caption = "Create Tax Form(Full Time)"
TaxFormPath = "C:\TaxForm\FullTimeStudents\"

Form_Open (False)

End Sub

Private Sub Option22_GotFocus()
cmdPrintAll.Caption = "Create Tax Form(Part Time)"
TaxFormPath = "C:\TaxForm\PartTimeStudents\"

End Sub