Connecting Tech Pros Worldwide Help | Site Map

setting fields based on values of other fields

Dan Cook
Guest
 
Posts: n/a
#1: Nov 13 '05


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 ***
Wayne Gillespie
Guest
 
Posts: n/a
#2: Nov 13 '05

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.

Dan
Guest
 
Posts: n/a
#3: Nov 13 '05

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