thornmastr
Programmer
I have defined as part of a personnel system a class called staff which is very straight forward and works well. However, two elements of the class are unfortunately not cut and dried. These are the Notes and the SchedulePreference elements of the class. Notes are for the Personnel Director. It allows him to record notes about the employee. It may have no information at all. It may have a few sentences, and for some employees it can contain volumes. To deal with this, both these two fields on the database (ACCESS mdb) are defined as memo fields. I think the problem is now becoming clear. VB does not directly support the
Memo data type. We can of course deal with that by using get chunk and append chunk. So, the question becomes how do we define the properties for “Notes”. It is not a string. I am assuming the chunk functions are really passing pointers back and forth, so do we use properties defined as long or as variant. To further confound the issue, if the length of the memo is less than 255 characters, is it a string or is it a memo? And how do we allow for certain methods. For example, within the definitions of notes,I want to handle a null condition, ie, there are no notes in which case we do nothing at all.
Currently I’m treating the schedule preference like a string. The notes I am treating as a variant and since I am still in development mode, that is not a problem, but I do need a solution. The following are my property definitions:
Public Property Get Notes() As Variant
If Not IsNull(m_Notes) Then
Notes = m_Notes.GetChunk(65000)
Else
Notes = ""
End If
End Property
Public Property Let Notes(ByVal Notes As Variant)
If Not IsNull(Notes) Then m_Notes.AppendChunk Notes
End Property
Public Property Get SchedulePreference() As String
SchedulePreference = m_SchedulePreference
End Property
Public Property Let SchedulePreference(ByVal SchedulePreference As String)
m_SchedulePreference = SchedulePreference
End Property
At this point I really do not know which course of action is the correct one to take. Comments, suggestions, criticisms are all most welcome.
Thank you,
Robert Berman
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@earthlink.net
Memo data type. We can of course deal with that by using get chunk and append chunk. So, the question becomes how do we define the properties for “Notes”. It is not a string. I am assuming the chunk functions are really passing pointers back and forth, so do we use properties defined as long or as variant. To further confound the issue, if the length of the memo is less than 255 characters, is it a string or is it a memo? And how do we allow for certain methods. For example, within the definitions of notes,I want to handle a null condition, ie, there are no notes in which case we do nothing at all.
Currently I’m treating the schedule preference like a string. The notes I am treating as a variant and since I am still in development mode, that is not a problem, but I do need a solution. The following are my property definitions:
Public Property Get Notes() As Variant
If Not IsNull(m_Notes) Then
Notes = m_Notes.GetChunk(65000)
Else
Notes = ""
End If
End Property
Public Property Let Notes(ByVal Notes As Variant)
If Not IsNull(Notes) Then m_Notes.AppendChunk Notes
End Property
Public Property Get SchedulePreference() As String
SchedulePreference = m_SchedulePreference
End Property
Public Property Let SchedulePreference(ByVal SchedulePreference As String)
m_SchedulePreference = SchedulePreference
End Property
At this point I really do not know which course of action is the correct one to take. Comments, suggestions, criticisms are all most welcome.
Thank you,
Robert Berman
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@earthlink.net