Connecting Tech Pros Worldwide Help | Site Map

setting fields based on values of other fields

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 01:28 PM
Dan Cook
Guest
 
Posts: n/a
Default setting fields based on values of other fields



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, 01:29 PM
Wayne Gillespie
Guest
 
Posts: n/a
Default 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, 01:29 PM
Dan
Guest
 
Posts: n/a
Default 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 ***
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.