Private Sub cmdShip_Click()
On Error GoTo Err_cmdShip_Click
Dim stRptName As String, stParam As String, stLinkCriteria As String, stDBpath As String, stFTPpath As String
Dim iPreview As Integer, iDialog As Integer, blnPrintIt As Boolean
stDBpath = CurrentProject.Path & "\"
stFTPpath = stDBpath & "Gazette\"
iPreview = acViewPreview
If Me.ChkPreview Then
' iPreview = 2
iDialog = acWindowNormal
Else
iDialog = acHidden
End If
stRptName = "Main_by_Ship"
stParam = Replace(LCase(Me.cboShip.Value), " ", "_")
stLinkCriteria = "[Ship] = '" & Me.cboShip.Value & "'"
'DoCmd.CopyObject , stParam, acReport, stRptName
If Me.ChkPreview Then
DoCmd.OpenReport stRptName, iPreview, , stLinkCriteria, iDialog
Else
DoCmd.OpenReport stRptName, iPreview, , stLinkCriteria, iDialog
DoCmd.OutputTo acOutputReport, stRptName, acFormatPDF, stFTPpath & stParam & ".pdf", False
DoCmd.Close acReport, stRptName
End If
'DoCmd.DeleteObject acReport, stParam
Exit_cmdShip_Click:
Exit Sub
Err_cmdShip_Click:
MsgBox Err.Description
Resume Exit_cmdShip_Click
End Sub
I do not get that error?
View attachment 119585
Functions generally return a value, as Subs do not. That function is not returning a value.?
A DCount() would count what should be the number of records (courses) for each student.
Not sure how you are doing it, as I have to go out now.
Also give your command buttons meaningful names.
As for a pdf document for each student, here is how I did similar for a DB of mine, basically a recordset of records required, then a report for each one where the report is filtered for each record.
Code:Private Sub cmdShip_Click() On Error GoTo Err_cmdShip_Click Dim stRptName As String, stParam As String, stLinkCriteria As String, stDBpath As String, stFTPpath As String Dim iPreview As Integer, iDialog As Integer, blnPrintIt As Boolean stDBpath = CurrentProject.Path & "\" stFTPpath = stDBpath & "Gazette\" iPreview = acViewPreview If Me.ChkPreview Then ' iPreview = 2 iDialog = acWindowNormal Else iDialog = acHidden End If stRptName = "Main_by_Ship" stParam = Replace(LCase(Me.cboShip.Value), " ", "_") stLinkCriteria = "[Ship] = '" & Me.cboShip.Value & "'" 'DoCmd.CopyObject , stParam, acReport, stRptName If Me.ChkPreview Then DoCmd.OpenReport stRptName, iPreview, , stLinkCriteria, iDialog Else DoCmd.OpenReport stRptName, iPreview, , stLinkCriteria, iDialog DoCmd.OutputTo acOutputReport, stRptName, acFormatPDF, stFTPpath & stParam & ".pdf", False DoCmd.Close acReport, stRptName End If 'DoCmd.DeleteObject acReport, stParam Exit_cmdShip_Click: Exit Sub Err_cmdShip_Click: MsgBox Err.Description Resume Exit_cmdShip_Click End Sub
Well you never said that?Sir i entered new student registration then error showed ...
Sir, is it possible that the subject count is multiplied by the subject fee, and after subtracting the discount, the total amount is shown?share file plzz i check
still same error show sirTest the form.
i try but i am not findSo given that both @arnelgp and @Gasman reported that the error was not raised when they used the application that you now need to do some investigation: look at the error message: What was the user defined function in After Update that cannot be found? Where did the UDF come from? Can you investigate and provide information to help yourself?
can you check sirCan you look at the properties of the list box, check the Event After update associated with it - and look at the vba? Can you set a Breakpoint at the start of the vba in that event and step thru the code: using <Fn - F8> until the error is triggered? What is the code on that line? Did you not write it - or copy it?
Can you look at the properties of the list box, check the Event After update associated with it - and look at the vba? Can you set a Breakpoint at the start of the vba in that event and step thru the code: using <Fn - F8> until the error is triggered? What is the code on that line? Did you not write it - or copy it?
Option Compare Database
Option Explicit
Public Function UpdateSubjCount()
Me.Dirty = False
Me.txtSubjectCount.Requery
Call Form_Current
End Function
Private Sub Form_Current()
If Nz(Me.Total_Fee, 0) <> (Nz(Me.txtSubjectCount, 0) * Nz(Me.subject_Fee, 0)) Then
Me.Total_Fee = Nz(Me.txtSubjectCount, 0) * Nz(Me.subject_Fee, 0)
Me.Dirty = False
End If
End Sub
still error you can enter new registration when you clink on course enroled error message popuphave you downloaded the db in post #9.
on my test on that db, there is no error.