[AccessD] Record Selector Withevents Demo

John W. Colby jcolby at colbyconsulting.com
Mon Mar 3 18:40:00 CST 2003


There is no "Advantage" as such.  Yours does exactly what mine does.  the
difference is that mine is a class, that uses two controls to "feed the
process".  Notice that since the text box txtRecID is bound, the name of the
field that it is bound to is available to me in a property of the text box.
I can simply read that property out to determine what the string should be
for the filter.

It's just exactly what you are doing but generic.  Cut and paste the two
controls (RecSel combo and RecID text box) into the form, bind the text box,
set the SQL for the combo and init the class and you are done.

Of course in my framework I do it slightly different.  I use a naming
convention to determine that the combo passed in is a record selector.  If
it is, I search for and grab a reference to the RecID control on my form.  I
always have one on every (bound) form anyway since it is useful for other
control SQL statements etc.  In the same class I do the NotInList and
DblClick event handlers so I have a generic "do it all" combo class, pretty
similar to merging the two combo classes that are on my site.  I split them
apart specifically to make them easier to understand.  In my framework it is
just a single class that does all of the above and more.

John W. Colby
Colby Consulting
www.ColbyConsulting.com


I've stopped 9,237 spam messages. You can too!
Get your free, safe spam protection at http://www.cloudmark.com/spamnetsig/

-----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
Sent: Monday, March 03, 2003 6:52 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Record Selector Withevents Demo


John:

I do something similar, ala carte, in my (fabulously) bound forms:

Private Sub cboAgreements_AfterUpdate()

    Me.RecordsetClone.FindFirst "[fldRAHID] = " & cboAgreements.Value
    If Me.RecordsetClone.NoMatch Then
        MsgBox "Agreement Number not found.", vbExclamation
    Else
        Me.Bookmark = Me.RecordsetClone.Bookmark
    End If

    cmdExit.SetFocus
    cboAgreements.Visible = False

End Sub

which displays a rental agreement selected from the combo box.  (Of course
the "Agreement Number not found.",  code should never execute.)

What is the advantage of what you've done vs. this?

Rocky

----- Original Message -----
From: "John W. Colby" <jcolby at colbyconsulting.com>
To: "AccessD" <AccessD at databaseadvisors.com>
Sent: Sunday, March 02, 2003 8:10 AM
Subject: [AccessD] Record Selector Withevents Demo


> I have added another withevents demo class to my site that is actually
> useful if you like the technique.  This class creates a combo box that is
> used as a record selector for finding records in bound forms.  The class
is
> initialized passing in the form, the record selector combo and a text box
> bound to the autonumber PK field.  When the user selects a record in the
> combo, the AfterUpdate event handler in the class is activated.  It finds
> the record in the form and sets the form's bookmark to that record so that
> the form "moves to" that record.  The class exposes a public method that
the
> form's current event calls that keeps the record selector combo pointing
to
> the same record that the form is on if the user moves through the records
> manually by page down etc.
>
> This class is fully functional, and can be used in your projects simply by
> importing the class, cutting and pasting the combo and text box onto your
> form, binding the text box to the PK field for that form, and setting the
> combo's SQL to the recID and one or more fields that allow the user to
> choose a record.  Cut and paste the code in the demo form and you are up
and
> running with a record selector on any bound form.
>
> The demo is fully functional and demonstrates this technique.
>
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
>
>
> I've stopped 9,208 spam messages. You can too!
> Get your free, safe spam protection at
http://www.cloudmark.com/spamnetsig/
>
> ----------------------------------------------------
> Is email taking over your day?  Manage your time with eMailBoss.
> Try it free!  http://www.eMailBoss.com
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



----------------------------------------------------
Is email taking over your day?  Manage your time with eMailBoss.  
Try it free!  http://www.eMailBoss.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3800 bytes
Desc: not available
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030303/d409e837/attachment-0001.bin>


More information about the AccessD mailing list