GKChesterton
Programmer
Access 2003, DAO not ADO. I want to use a class module to address a record in a field. The instance is a record and its properties are fields. For example, if the table WeatherHistory has 365 records that summarize weather for the last twelve months, and I want to update the high temperature for a certain date, then in the past I'd have done something like
Instead of running that, I want to instantiate a class module:
I can see how to make a Sub and go take care of it using FindFirst:
But that obviously isn’t exploiting OOP; and I have a lot of manipulations ahead, thus a lot of FindFirst routines. How is this done?
Code:
sngReading = 90 ‘Fahrenheit, mind you …
datDateNeedsChange = #6/1/2009#
DoCmd.RunSQL “UPDATE WeatherHistory SET HiTemp =” & sngReading _
& “ WHERE HistoryDate=” & datDateNeedsChange
Instead of running that, I want to instantiate a class module:
Code:
objWeatherHistory.HiTemp = sngHiTemperature
I can see how to make a Sub and go take care of it using FindFirst:
Code:
objWeatherHistory.HiTemp(datDateNeedsChange) = sngHiTemperature
. . . rsWH.FindFirst “HistoryDate=” & datDateNeedsChange
rsWH.Edit
rsWH!HiTemp = 90
rsWH.Update
[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]