B
Bev
I am receiving the following error message. I have also
pasted the code below.
"The expression On Open you entered as the event property
setting produce the following error: User-devined type
not defined.
* The expression may not result in the name of a macro,
the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function,
event, or macro.
CODE:
Dim DB As Database
Dim GrpPages As Recordset
Function GetGrpPages()
'Find the group name.
GrpPages.Seek "=", Me![Country]
If Not GrpPages.NoMatch Then
GetGrpPages = GrpPages![Page Number]
End If
End Function
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
'Set page number to 1 when a new group starts.
Page = 1
End Sub
Private Sub PageFooterSection_Format(Cancel As Integer,
FormatCount As Integer)
'Find the group.
GrpPages.Seek "=", Me![Country]
If Not GrpPages.NoMatch Then
'The group is already there.
If GrpPages![Page Number] < Me.Page Then
GrpPages.Edit
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
Else
'This is the first page of the group. Therefore,
add it.
GrpPages.AddNew
GrpPages![Country] = Me![Country]
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Set DB = DBEngine.workspaces(0).databases(0)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From [Category Group Pages];"
DoCmd.SetWarnings True
Set GrpPages = DB.OpenRecordset("Category Group
Pages", DB_OPEN_TABLE)
GrpPages.Index = "PrimaryKey"
End Sub
..
pasted the code below.
"The expression On Open you entered as the event property
setting produce the following error: User-devined type
not defined.
* The expression may not result in the name of a macro,
the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function,
event, or macro.
CODE:
Dim DB As Database
Dim GrpPages As Recordset
Function GetGrpPages()
'Find the group name.
GrpPages.Seek "=", Me![Country]
If Not GrpPages.NoMatch Then
GetGrpPages = GrpPages![Page Number]
End If
End Function
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
'Set page number to 1 when a new group starts.
Page = 1
End Sub
Private Sub PageFooterSection_Format(Cancel As Integer,
FormatCount As Integer)
'Find the group.
GrpPages.Seek "=", Me![Country]
If Not GrpPages.NoMatch Then
'The group is already there.
If GrpPages![Page Number] < Me.Page Then
GrpPages.Edit
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
Else
'This is the first page of the group. Therefore,
add it.
GrpPages.AddNew
GrpPages![Country] = Me![Country]
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Set DB = DBEngine.workspaces(0).databases(0)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From [Category Group Pages];"
DoCmd.SetWarnings True
Set GrpPages = DB.OpenRecordset("Category Group
Pages", DB_OPEN_TABLE)
GrpPages.Index = "PrimaryKey"
End Sub
..