M
Milton
I am getting an error running the following code. The voucher query selects
into a table. One of the fields in the query is populated by a public
function I created. The code returns an error indicating it can't find the
function. Is there a way I can reference the function? The function is in a
separate module and is below also.
Public Sub InitialStuff()
On Error GoTo autoexec_Err
If Not IsNull("cc_t") Then
DoCmd.RunSQL " Drop Table cc_t ", -1
End If
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT voucher.FY, voucher.CardPurYr, voucher.CardMonth,
voucher.OrgCodes, voucher.BOC, voucher.CostOrg, voucher.SumOfGrandTotal INTO
cc_T FROM voucher GROUP BY voucher.FY, voucher.CardMonth, voucher.OrgCodes,
voucher.BOC, voucher.CostOrg, voucher.SumOfGrandTotal;", -1
DoCmd.SetWarnings True
autoexec_Exit:
Exit Sub
autoexec_Err:
MsgBox Error$
Resume autoexec_Exit
End Sub
Public Function getFYear(ccdate As Date) As Integer
Dim fdate As Date
If getFmonth(ccdate) > 0 And getFmonth(ccdate) < 4 Then
getFYear = DatePart("yyyy", ccdate) + 1
End If
If getFmonth(ccdate) > 3 Then
getFYear = DatePart("yyyy", ccdate)
End If
End Function
into a table. One of the fields in the query is populated by a public
function I created. The code returns an error indicating it can't find the
function. Is there a way I can reference the function? The function is in a
separate module and is below also.
Public Sub InitialStuff()
On Error GoTo autoexec_Err
If Not IsNull("cc_t") Then
DoCmd.RunSQL " Drop Table cc_t ", -1
End If
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT voucher.FY, voucher.CardPurYr, voucher.CardMonth,
voucher.OrgCodes, voucher.BOC, voucher.CostOrg, voucher.SumOfGrandTotal INTO
cc_T FROM voucher GROUP BY voucher.FY, voucher.CardMonth, voucher.OrgCodes,
voucher.BOC, voucher.CostOrg, voucher.SumOfGrandTotal;", -1
DoCmd.SetWarnings True
autoexec_Exit:
Exit Sub
autoexec_Err:
MsgBox Error$
Resume autoexec_Exit
End Sub
Public Function getFYear(ccdate As Date) As Integer
Dim fdate As Date
If getFmonth(ccdate) > 0 And getFmonth(ccdate) < 4 Then
getFYear = DatePart("yyyy", ccdate) + 1
End If
If getFmonth(ccdate) > 3 Then
getFYear = DatePart("yyyy", ccdate)
End If
End Function