Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A touch of Class.

Status
Not open for further replies.

thornmastr

Programmer
Feb 2, 2002
1,337
US
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
 

I don't understand completely.
If it is a JET field of type Memo, and it holds Text, you can use a VB String variable to hold the data, and also display the data in a TextBox or RichTextBox.

Say there is a Memo field containing the Words: "This Is an Memo field"

Dim strNotes As String

strNotes =rsADO.Fields("Information").GetChunk(rsADO.Fields("Information").ActualSize)

will return the same...(of course you can get the data in chunks of 255 bytes at a time and string the data together)

If it holds LongBinary data such as a bitmap, or RTF format, then that a little different.



 
CCLINT,

Thanks for the informative response. My ideas was to attempt to find out how best to define these particular fields; as strings, memos, blobs, chunks, pointers to something…..what?

After numerous testing and discussions, the conclusion really is “flip a coin”, it matters very little if at all. VB will deal with a memo type to ariund 64KB+ as a string. After that, you are best served using a chunk.

I did have a problem working with

strNotes =rsADO.Fields("Information").GetChunk(rsADO.Fields("Information").ActualSize) ;

it kept complaining about an issue with the lack of a set and I would expect a problem if there were no data at all.

Again, thank you for the information.

Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@earthlink.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top