Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / October 2003



Tip: Looking for answers? Try searching our database.

A touch of class <sic>

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Berman - 30 Oct 2003 21:18 GMT
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
Steve Gerrard - 31 Oct 2003 04:53 GMT
> 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
[quoted text clipped - 53 lines]
>
> Robert Berman

Hi, Robert.

I'm not so sure there is an issue with the memo field. I believe that both the
Access memo field and the VB string are limited to about 64K characters. Why
can't you just treat a memo field like a string? I know have, although the
strings are probably  < 2K.

You can still have a method that appends new notes, with the line
   m_Notes = m_Notes & NewNote
in it. It may not be super efficent, but I don't see why it wouldn't work.

Steve
Robert Berman - 31 Oct 2003 14:30 GMT
Hello Steve,

I have a lot of commentary I would like to pursue here. Unfortunately,
or perhaps fortunately, I have an appointment in a half hour and will
shortly be leaving for about an hour and a half or so. So, first off,
you are absolutely correct. After much testing, your solution works very
well and I am using it. For that I certainly thank you.

I am a bit confused in that Access construes a string to be 255
characters even though we know a VB string can be around 64KB. So for
some reason I simply thought, well, if over 255 we deal with Chunks.

I certainly made two days of extra work for very little reward but what
a learning experience.

Again, thank you very much.

Robert

>>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
[quoted text clipped - 66 lines]
>
> Steve
Don@home.com - 31 Oct 2003 15:31 GMT
>Hello Steve,
>
[quoted text clipped - 5 lines]
>
>I am a bit confused in that Access construes a string to be 255

Use a Memo record type. (IIRC, 1.2GB)

>characters even though we know a VB string can be around 64KB. So for

2 giga bytes for varible length strings

>some reason I simply thought, well, if over 255 we deal with Chunks.

As of late never found a reason other than system paging to use Chunks.. (If
this becomes a real problem then I reconsider how I'm storing the data)
Also, can your data type be used Chunks? If so the Chunk size should be as large
as possible...

Just Food for Thought...

>I certainly made two days of extra work for very little reward but what
>a learning experience.
[quoted text clipped - 73 lines]
>>
>> Steve

Have a good day...

Don
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.