Automatically filling a field on a form

  • Thread starter Thread starter bill anderson
  • Start date Start date
B

bill anderson

I want to automatically fill a field on a form based on
input from another field. I have a field that looks at
another table for input (its a combo box/field
called "award_definition"). Once I select from that combo
box the selection of choice either "on exit" or "after
update" control I want the code to look at the same
lookup table that I got the input for "award definition"
and look at another field linked to award_definition and
automatically fill a field called "AWD_CAT". I tried some
code from Byron that used DLookup but can't get it to
work. Does anyone out there have any ideas.

Bill
 
Hi Bill,

You might try this way:

Have the query for your combobox return "award_definition" as well. Then, in
the combobox AfterUpdate event put the code to load the textbox with the
definition:

me![AWD_CAT] = me!MyCbo.column(1).

(the column collection is zero based as opposed to the column references you
see in design mode which are 1 based)

HTH
 
Larry,

Will I be able to do that since I did not use a query to
create the combo box I used a lookup table to limit the
choices in the combo box on the form? The
award_definition is the field that I will choose from and
the awd_cat is the once I want filled automatically.

Thanks for your response

Bill
-----Original Message-----
Hi Bill,

You might try this way:

Have the query for your combobox
return "award_definition" as well. Then, in
the combobox AfterUpdate event put the code to load the textbox with the
definition:

me![AWD_CAT] = me!MyCbo.column(1).

(the column collection is zero based as opposed to the column references you
see in design mode which are 1 based)

HTH
--
-Larry-
--

I want to automatically fill a field on a form based on
input from another field. I have a field that looks at
another table for input (its a combo box/field
called "award_definition"). Once I select from that combo
box the selection of choice either "on exit" or "after
update" control I want the code to look at the same
lookup table that I got the input for "award definition"
and look at another field linked to award_definition and
automatically fill a field called "AWD_CAT". I tried some
code from Byron that used DLookup but can't get it to
work. Does anyone out there have any ideas.

Bill


.
 
Thanks Larry - I just came to the newsgroup to ask this very question and
your suggestion worked great for me.


Larry Daugherty said:
Hi Bill,

You might try this way:

Have the query for your combobox return "award_definition" as well. Then, in
the combobox AfterUpdate event put the code to load the textbox with the
definition:

me![AWD_CAT] = me!MyCbo.column(1).

(the column collection is zero based as opposed to the column references you
see in design mode which are 1 based)

HTH
--
-Larry-
--

bill anderson said:
I want to automatically fill a field on a form based on
input from another field. I have a field that looks at
another table for input (its a combo box/field
called "award_definition"). Once I select from that combo
box the selection of choice either "on exit" or "after
update" control I want the code to look at the same
lookup table that I got the input for "award definition"
and look at another field linked to award_definition and
automatically fill a field called "AWD_CAT". I tried some
code from Byron that used DLookup but can't get it to
work. Does anyone out there have any ideas.

Bill
 
Hi Bill,

Sorry, I didn't check in for a few days.

Yes, it will work directly from the table so long as you include enough
fields and that you resolve which field/column you need to load into your
target text box.

HTH
--
-Larry-
--

Bill Anderson said:
Larry,

Will I be able to do that since I did not use a query to
create the combo box I used a lookup table to limit the
choices in the combo box on the form? The
award_definition is the field that I will choose from and
the awd_cat is the once I want filled automatically.

Thanks for your response

Bill
-----Original Message-----
Hi Bill,

You might try this way:

Have the query for your combobox
return "award_definition" as well. Then, in
the combobox AfterUpdate event put the code to load the textbox with the
definition:

me![AWD_CAT] = me!MyCbo.column(1).

(the column collection is zero based as opposed to the column references you
see in design mode which are 1 based)

HTH
--
-Larry-
--

I want to automatically fill a field on a form based on
input from another field. I have a field that looks at
another table for input (its a combo box/field
called "award_definition"). Once I select from that combo
box the selection of choice either "on exit" or "after
update" control I want the code to look at the same
lookup table that I got the input for "award definition"
and look at another field linked to award_definition and
automatically fill a field called "AWD_CAT". I tried some
code from Byron that used DLookup but can't get it to
work. Does anyone out there have any ideas.

Bill


.
 
Back
Top