Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Best practice...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
brian3d - 28 Jun 2007 03:31 GMT
Information: Access2007
Requirement: I have four text box's. The first one I would like to auto fill
based on a selection made in another form. Once the auto fill is done, I want
the three corresponding box's to auto fill based off of the first box's
information.

The first box's information is an object, while the three corresponding boxs
are the three characteristics of that object. So in one form, that object is
selected, then it is autofilled into a box on another form, were I then want
it's three characteristics to auto populate.

The question: I'm basically looking for a best practice solution to cascading
the characteristics into the three boxs, based off of what object is selected.

I hope I have explained this clearly enough for understanding. Any help would
be apprecated.
Scott McDaniel - 28 Jun 2007 11:00 GMT
>Information: Access2007
>Requirement: I have four text box's. The first one I would like to auto fill
[quoted text clipped - 9 lines]
>The question: I'm basically looking for a best practice solution to cascading
>the characteristics into the three boxs, based off of what object is selected.

Assuming you're storing the default values of your "object" in a table, then just open a recordset after the main object
is filled, then fill your other textboxes:

Dim rst As ADODB.Recordset

Set rst = new ADODB.Recordset
rst.OPen "SELECT * FROM SomeTable WHERE SomeObjectID=" & TheSelectedObjectID, CurrentProject.Connection

If Not (rst.EOF and rst.BOF) Then
 '/now fill your textboxes
 With Forms("YourOtherForm")
   .Textbox1 = rst("Field1")
   .Textbox2= rst("Field2")
   .Textbox3= rst("Field3")
 End With
End IF

Set rst = Nothing

>I hope I have explained this clearly enough for understanding. Any help would
>be apprecated.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
brian3d - 29 Jun 2007 02:24 GMT
Thank you for the info Scott, apprecate the advice.

>>Information: Access2007
>>Requirement: I have four text box's. The first one I would like to auto fill
[quoted text clipped - 27 lines]
>scott@takemeout_infotrakker.com
>www.infotrakker.com
John W. Vinson - 28 Jun 2007 18:43 GMT
>Information: Access2007
>Requirement: I have four text box's. The first one I would like to auto fill
[quoted text clipped - 12 lines]
>I hope I have explained this clearly enough for understanding. Any help would
>be apprecated.

Two points:

1. You're not storing data in a Form. The form is JUST A WINDOW; the data is
stored in your Table, not in the textboxes.

2. If you're extracting these three fields from one table and storing them
redundantly in another table, you are probably making a big mistake.
Relational databases use the "Grandmother's Pantry Principle": "a place - ONE
place! - for everything, everything in its place". You may just want to store
a foreign key, a link to the object table to *display* the characteristics.
It's convenient to use a Combo Box to select from the list of objects; you can
include the other three fields in the combo's Row Source query and display
them on the form using textboxes with control sources like

=comboboxname.Column(n)

where n is the zero based index of the field you want displayed.

If you have a good reason to store the data redundantly please explain - it
can be done, it's just that "best practices" would usually prohibit doing so.

            John W. Vinson [MVP]
brian3d - 29 Jun 2007 02:25 GMT
Thank you John, apprecate the advice.

>>Information: Access2007
>>Requirement: I have four text box's. The first one I would like to auto fill
[quoted text clipped - 24 lines]
>
>             John W. Vinson [MVP]
 
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



©2008 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.