Connecting Tech Pros Worldwide Help | Site Map

setting fields based on values of other fields

  #1  
Old November 13th, 2005, 02:28 PM
Dan Cook
Guest
 
Posts: n/a


Ok... here's the scoop... I've got an unbound form with Serial Number,
Building, and Room... all this is in tableA... Now I've got the form
setup with building, room and serial number as combo fields... I've got
it so that when you click the dropdown on Building it queries the table
for all buildings, then the one for room queries for all the rooms in
the picked building, and the serial number drop down queries on building
or building and room... so far so good. I would like to make it so if
a serial number is picked from the drop down box before building and
room are picked that these fields would auto-fill based on the
corresponding values in the table...

Anyone have any ideas here?

*** Sent via Developersdex http://www.developersdex.com ***
  #2  
Old November 13th, 2005, 02:29 PM
Wayne Gillespie
Guest
 
Posts: n/a

re: setting fields based on values of other fields


On Wed, 07 Sep 2005 21:10:19 GMT, Dan Cook <dcook@finleysd.org> wrote:
[color=blue]
>
>
>Ok... here's the scoop... I've got an unbound form with Serial Number,
>Building, and Room... all this is in tableA... Now I've got the form
>setup with building, room and serial number as combo fields... I've got
>it so that when you click the dropdown on Building it queries the table
>for all buildings, then the one for room queries for all the rooms in
>the picked building, and the serial number drop down queries on building
>or building and room... so far so good. I would like to make it so if
>a serial number is picked from the drop down box before building and
>room are picked that these fields would auto-fill based on the
>corresponding values in the table...
>
>Anyone have any ideas here?
>
>*** Sent via Developersdex http://www.developersdex.com ***[/color]

In the rowsource of the serial number combo include the building and
room as hidden columns. So in the query or SQL string that is the
rowsource of the combo you will have 3 fields - Serial Number,
Building and Room. Set the ColumnWidth property of the combo to
something like 1;0;0
The first figure (1) is the width you want to set for the Serial
Number, so set this value to an appropriate width to allow the S/N to
be fully seen when it is dropped down. The 2nd and 3rd values are the
width for the Building and Room columns, because they are set to 0
these columns are hidden but the underlying values are still
accessable.

In the AfterUpdate event of the S/N combo put something like -

Me.cboBuilding = Me.cboSerialNumber.Column(1)
Me.cboRoom = Me.cboSerialNumber.Column(2)

The Columns property is zero based so -
SerialNumber = Column 0
Building = Column 1
Room = Column 2

When the S/N combo is changed, the corresponding values for Building
and Room will be read from the S/N combo's rowsource and written the
the Buiding and Room combos.

  #3  
Old November 13th, 2005, 02:29 PM
Dan
Guest
 
Posts: n/a

re: setting fields based on values of other fields


doh!.... great thought... Thanks for the help as it is greatly
appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a form from a subform based on 3 crtiteria birt answers 3 September 21st, 2007 05:35 PM
Error looping through controls on form in Access 2003 TD answers 16 November 17th, 2005 05:55 AM
Setting DSN programmatically ? Zlatko Matiæ answers 11 November 13th, 2005 11:17 AM
Recordset in subform based on field in parent form Lyn answers 25 November 13th, 2005 12:52 AM