set the value of a field

G

Guest

I have 2 tables, one has company info including a fee field. Then I have a
table with inspections that include the company and the fee for that company.
I have a form which I enter new inspections in. I have a combo box that I
choose the company for each inspection.
What I want to happen is the fee for the company I just selected to be put
into the inspection fee field. I have tried using the setvalue function in a
macro but I keep getting automation errors. I have a query that will select
the fee from the company in the inspections form. So I have the value but I
do not know how to get it to automatically show up in the inspection form
[fee] field. Please help! I have been messing with this for months.
 
T

tina

the easy way: open your Inspections form in design view. in the Company
combobox control, go to the RowSource property and add the Fee field from
the Company table to the RowSource. don't forget to increase the ColumnCount
property's value by 1. and in the ColumnWidths property, add
; 0"
to the end of the value (so the additional column is included, but its'
width is set to zero and it will not show in the droplist in form view).
in the combobox's AfterUpdate event, add a macro or VBA code to set the
value of the Fee control to the new column in the combobox, as

Me!FeeControlName = Me!ComboboxName.Column(n)

substitute the correct names of the controls, of course. change the (n)
value to the index for the Fee column in the combobox; note that combobox
columns are zero-based, which means that the first column (moving left to
right) is indexed as (0), the second column is (1), the third column is (2),
etc.

hth
 
G

Guest

This worked!!!! Thank you SOOOO much!!

Joe

tina said:
the easy way: open your Inspections form in design view. in the Company
combobox control, go to the RowSource property and add the Fee field from
the Company table to the RowSource. don't forget to increase the ColumnCount
property's value by 1. and in the ColumnWidths property, add
; 0"
to the end of the value (so the additional column is included, but its'
width is set to zero and it will not show in the droplist in form view).
in the combobox's AfterUpdate event, add a macro or VBA code to set the
value of the Fee control to the new column in the combobox, as

Me!FeeControlName = Me!ComboboxName.Column(n)

substitute the correct names of the controls, of course. change the (n)
value to the index for the Fee column in the combobox; note that combobox
columns are zero-based, which means that the first column (moving left to
right) is indexed as (0), the second column is (1), the third column is (2),
etc.

hth


Joeb said:
I have 2 tables, one has company info including a fee field. Then I have a
table with inspections that include the company and the fee for that company.
I have a form which I enter new inspections in. I have a combo box that I
choose the company for each inspection.
What I want to happen is the fee for the company I just selected to be put
into the inspection fee field. I have tried using the setvalue function in a
macro but I keep getting automation errors. I have a query that will select
the fee from the company in the inspections form. So I have the value but I
do not know how to get it to automatically show up in the inspection form
[fee] field. Please help! I have been messing with this for months.
 
T

tina

you're so welcome! :)


Joeb said:
This worked!!!! Thank you SOOOO much!!

Joe

tina said:
the easy way: open your Inspections form in design view. in the Company
combobox control, go to the RowSource property and add the Fee field from
the Company table to the RowSource. don't forget to increase the ColumnCount
property's value by 1. and in the ColumnWidths property, add
; 0"
to the end of the value (so the additional column is included, but its'
width is set to zero and it will not show in the droplist in form view).
in the combobox's AfterUpdate event, add a macro or VBA code to set the
value of the Fee control to the new column in the combobox, as

Me!FeeControlName = Me!ComboboxName.Column(n)

substitute the correct names of the controls, of course. change the (n)
value to the index for the Fee column in the combobox; note that combobox
columns are zero-based, which means that the first column (moving left to
right) is indexed as (0), the second column is (1), the third column is (2),
etc.

hth


Joeb said:
I have 2 tables, one has company info including a fee field. Then I
have
a
table with inspections that include the company and the fee for that company.
I have a form which I enter new inspections in. I have a combo box
that
I
choose the company for each inspection.
What I want to happen is the fee for the company I just selected to be put
into the inspection fee field. I have tried using the setvalue
function
in a
macro but I keep getting automation errors. I have a query that will select
the fee from the company in the inspections form. So I have the value
but
I
do not know how to get it to automatically show up in the inspection form
[fee] field. Please help! I have been messing with this for months.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top