----- Original Message ----- 
From: "Adelle Hartley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 2004 11:12 PM
Subject: RE: [vbhelp] Re: db access again.


> Hi,
>
> HouseDad wrote:
> >
> >      You helped me solve a problem.  Thank you.  I am curious
> > about these statements you made:
> >
> > > Stay away from bound controls.
> >
> >      Is this the same as the textbox property having the
> > control and file properties set?  Using the DATA1 control?
> >
> > >  You will find it easier to switch to using arrays later,
> > if you use
> > > unbound controls.
> >
> >      By this do you mean storing input in an array, then just
> > writing the data from the array to the database directly
> > instead of it happening automatically because the textbox
> > controls are "bound" to the database?
>
> What Jimbobob was talking about and my reply to him was about storing the
> contents of a whole table (or a big chunk) in an array.  This is not what
is
> usually meant by using unbound controls.
>
> Yes, when you set the DataSource property of a TextBox, you are using a
> bound control.
>
> A common unbound approach, for applications that typically have only one
> record (or a small number of related records) open at a time, is for the
> form to store the values for all of the visible fields in a member
variable
> of type "Recordset"
>
> The recordset, might have been fetched using either DAO or ADO (or perhaps
> even some other third party DB library).
>
> From this point on, there are some variations in technique.  The recordset
> may or may not be read-only.
>
> In one approach (pessimistic locking), an attempt is made to put the
current
> record into an "Edit" state as soon as the user starts typing on the form.
> This means that the record is not locked until they start typing, and you
> have a chance to handle the situation where the record is locked by
another
> user.  (This is called pessimistic locking).
>
> In another approach (optimistic locking) no attempt is made to update the
> database until the user has hit "Save" or moved on to the next record.  At
> that point, the database is updated.  The application may be overwriting
> changes made by another user (during the time between the first user
opening
> the record and hitting save).  Extra checks have to be written in to
detect
> this situation and deal with it.
>
> >
> > >  (It is possible to write your
> > > own binding layer but that's a rather code-heavy approach).
> >
> >     I use a for/next loop to assign the database field
> > equivalent to the textbox fields on my form.  This is what I
> > think of when you talk about a binding layer, which can't
> > possibly be right.
>
> I am confused by this statement.  I can't tell from this whether you are
> using unbound controls or not.
>
Based upon your earlier statement that the field names are stored in the tag
property, I would say that you are using unbound fields, and assigning the
data from the recordset to the text boxes at runtime.

If this is the case, the only main difference from what you are doing  and
what is being recommended to you is that you are using the data control.
Using DAO,  which I think I recall you using, all that is required to remove
the dataControl is to open the recordset in code and use it directly without
the data control. i.e. set Db = DAO.opendatabase("Myfile.MDB")
                set RS=db.openRecordset(SQLSTRING)   (This is the same as
the recordsource of

the datacontrol)
If you declare the DB and RS objects at the form level, they will be
available through all of the form.  Then all that is required is to treat
the RS object in the data way you treat the Data1.recordset object, with the
exception that you need to explicitly close them and set them to Null when
the form unloads.

Matt.









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to