Results 1 to 3 of 3
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    call class function from object


    I have

    Code:
    Private Sub Button_Save_Click()
    
    
    If varBookingSaved = True Then
    DoCmd.Close acDefault, Me.Form.Name, acSaveNo
    Exit Sub
    End If
    
    
    Call tagMustComplete("MustComplete", Me.Form, Text_ShowTime2nd.BorderColor)
    
    
    Dim Booking As NewBookingClass
    Set Booking = New NewBookingClass
    
    
    'booking details
    Booking.MemoBooking = Me.Text_MemoBooking.Value
    Booking.MemoSchool = Me.Text_MemoSchool.Value
    Booking.MemoPerformer = Me.Text_MemoPerformer.Value
    
    
    Booking.OrderDate = Date
    Booking.YearID = Me.Combo_BookingYear.Column(0)
    Booking.BookingDate = Me.Text_BookingDate.Value
    Booking.ShowID = Me.Combo_Show.Column(0)
    Booking.ShowName = Me.Combo_Show.Column(1)
    Booking.ShowStatusID = Me.Combo_BookingStatus.Column(0)
    Booking.PricePerStudent = Me.Text_PricePerStudent.Value
    Booking.BookingMinimum = Me.Text_BookingMinimum.Value
    Booking.EstimatedAttendance = Me.Text_Attendance.Value
    
    
    Booking.SchoolID = Me.Text_SchoolsID.Value
    Booking.TeacherName = Me.Text_TeacherName.Value
    Booking.TeacherSurname = Me.Text_TeacherSurname.Value
    Booking.TeacherEmail = Me.Text_TeacherEmail.Value
    
    
    Booking.time1 = Me.Text_ShowTime1st.Value
    Booking.time2 = Me.Text_ShowTime2nd.Value
    Booking.time3 = Me.Text_ShowTime3rd.Value
    Booking.time4 = Me.Text_ShowTime4th.Value
    Booking.time5 = Me.Text_ShowTime5th.Value
    
    
    Booking.TOHandlingID = Nz(TempVars!tmpto_id, 0)
    Booking.TOHandling = Nz(TempVars!tmpto_fullname, "Office")
    Booking.TOBonusID = Nz(0, 0)
    Booking.TOBonusName = Nz("Temp Name", "Office")
    
    
    Call Booking.SaveBooking
    Booking.PrintOut
    
    
    End Sub
    It faults on call Booking.SaveBooking

    Savebooking function baisically saves all the public variables in the class to a recordset (puts the variables into a table row)

    However I get a runtime '3265' item not found in this collection

    I guess I am calling it wrong - it is a public function within the class and shows when I type the dot after the object name "booking"

    I tried () and call but both give me the error.

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Nevermind it was the incorrect names of the fields in the functions recordset that sparked the error - just didn't take me to the line in the function which means I didn't know where in the function I had the issue....

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Can you post your database or the class module (NewBookingClass) you created?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need VBA code/"Class Object" for a bound form
    By kewelch in forum Programming
    Replies: 6
    Last Post: 06-27-2013, 09:26 AM
  2. Object or class not supporting set of events
    By Glenn_Suggs in forum Access
    Replies: 10
    Last Post: 11-15-2012, 11:56 AM
  3. Replies: 1
    Last Post: 04-26-2012, 12:14 AM
  4. Object or class does not support the set of events??
    By mejia.j88 in forum Programming
    Replies: 5
    Last Post: 12-12-2011, 12:01 PM
  5. object or class does not support the set of events
    By couch potato in forum Programming
    Replies: 2
    Last Post: 03-20-2010, 08:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums