>
"when I create and set the myTour = "tour id", then all of the recordsets
for bus company, hotels, rates etc gets loaded into the object."
Could you just expand a little on this please? How does the data get
loaded, do you open a recordset in a subroutine? Still missing the point
here I think!
Yes, in code I could go
dim tour1 as new clsrides
dim tour2 as new clsRides
tour1.TourID = 123 ' load tour 123
tour2.TourID = 34 'load tour 34
At this point, I have TWO tours loaded in ram, and thus go
msgbox "hotel for tour 123 is " & Tour1.HotelName
msgbox "hotel for tour 34 is" & Tour2.HotelName
So, note how the above was VERY little coding, and I can have TWO tours in
memory at the SAME time. And, even if I just need one in code...it is still
much easer then a bunch of subroutines and global variables that would trip
over them selves....
The class object is over 600 lines of code in total.....
Additional properties of the class object are outlined here:
http://www.members.shaw.ca/AlbertKal...Appendex4.html
The left side does NOT display all properties, but gives you an idea.....
the actual code in the class object for TourID is:
Public Property Let TourId(LoadID As Long)
' Loads/setsup the tour object (pricing etc..)
' DO NOT load if id is same as passed....
Dim myDB As Database
Dim qryBusList As QueryDef
Set myDB = DBEngine(0)(0)
If m_TourId <0 Then
' tour is loaded, check for same tour...
If m_TourId = LoadID Then
' tour already loaded...don't re-load
Exit Property
End If
End If
m_TourId = LoadID
' loads the load rates....
Set m_rstTour = myDB.OpenRecord set("select * from tbltours where id = " &
m_TourId)
With m_rstTour
If .RecordCount 0 Then
m_FromDate = !FromDate
m_Todate = !ToDate
m_HotelId = !Hotel
m_dtDepositDue = m_FromDate - !DaysDue
' load up hotel informaton
Set m_rstHotel = myDB.OpenRecord set("select * from tblHotels where
id = " & m_rstTour!Hotel )
' load up buses attachted to this tour
Set qryBusList = myDB.QueryDefs( "qryTourBusList B")
qryBusList.Para meters(0) = m_TourId
Set m_rstBusList = qryBusList.Open Recordset
' load up seasonal pricing talbes
Call TLoadRates
' set tax tax.
If m_rstTour!NoGst = True Then
m_GstRate = 0
Else
m_GstRate = gblGst(m_FromDa te)
m_PstRate = gblPst(m_FromDa te)
End If
Else
m_TourId = 0
End If
End With
End Property
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com