Getting Default Value

  • Thread starter Thread starter Faz
  • Start date Start date
F

Faz

I have a TABLE called "cleaning packages" with 4 columns
column1= PID, primary key
column2= Packages, list of many cleaning packages offered by a company
column3= Cars, cost of corresponding cleaning package for cars in $
column4= Vans/SUV, cost of corresponding cleaning package for Vans/SUV in $

I also have a FORM call "work order"

On the WORK ORDER form I have a combo box called JOB1 where I can select one
of the various cleaning packages from column2 of the table above and another
input field beside it called COST1.

On the form, when I select one of the "cleaning package" from the table, I
would like the COST1 field to show the Cost for cars as the DEFAULT value.

Can you please help me.
Thanks
Faz
 
Faz said:
I have a TABLE called "cleaning packages" with 4 columns
column1= PID, primary key
column2= Packages, list of many cleaning packages offered by a company
column3= Cars, cost of corresponding cleaning package for cars in $
column4= Vans/SUV, cost of corresponding cleaning package for Vans/SUV in
$

I also have a FORM call "work order"

On the WORK ORDER form I have a combo box called JOB1 where I can select
one
of the various cleaning packages from column2 of the table above and
another
input field beside it called COST1.

On the form, when I select one of the "cleaning package" from the table, I
would like the COST1 field to show the Cost for cars as the DEFAULT value.

Can you please help me.
Thanks
Faz

Put this code in the AfterUpdate event procedure for JOB1:

Me.COST1 = Me.JOB1.Column(2)

(columns are zero-based, so 2 actually refers to the third column)
 
Stuart McCall said:
Put this code in the AfterUpdate event procedure for JOB1:

Me.COST1 = Me.JOB1.Column(2)

(columns are zero-based, so 2 actually refers to the third column)
Hi Stuart:
I just tried it and it doesn't work. Please note that...
COST1 and JOB1 is on the FORM and the Column(2) i am referring to is in the
TABLE called "Cleaning Packages"
Please respont
Thanks
Faz
 
Faz said:
Hi Stuart:
I just tried it and it doesn't work. Please note that...
COST1 and JOB1 is on the FORM and the Column(2) i am referring to is in
the
TABLE called "Cleaning Packages"
Please respont
Thanks
Faz

Presumably JOB1 has a query or select statement as its rowsource. If a
query, open the query in design view and add the "cost for cars" field to it
(if a select statement, click the build button and do the same). Then set
the JOB1 combo's ColumnCount and ColumnWidths properties so that the cost
column is hidden (give it a width of 0 in the ColumnWidths property). Then
use code similar to what I posted to fill the COST1 control.

HTH
 
Stuart McCall said:
Presumably JOB1 has a query or select statement as its rowsource. If a
query, open the query in design view and add the "cost for cars" field to it
(if a select statement, click the build button and do the same). Then set
the JOB1 combo's ColumnCount and ColumnWidths properties so that the cost
column is hidden (give it a width of 0 in the ColumnWidths property). Then
use code similar to what I posted to fill the COST1 control.

HTH

Hi Stuart;

Thank you very much. It works. That's exactly what i wanted to know
 
Back
Top