problem with autopopulating a field

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Your data doesn't save to the table because the control is
bound to the DLookup function and not the table. To save
to the table you'll have to set the control equal to what
you want it to save in the table through VBA or a macro.
You can use the "Set Value" action in a macro or use code
in the "OnChange" event of the combobox something like:

[YourTargetControl] = [YourDesiredValue]
 
Okay, I'm a little confused. First of all. The value in the comboBox IS
updated in the table, obviously because the comboBox's control source is
fine, because its the corresponding field in the table. The problem arises in
the Text Boxes, their control source is the DLookUp function that uses the
value in the comboBox to populate themselves.

Does this change your answer at all??? Because I tried going into the
textBoxes properties and changed the event "OnChange" to:

[Vals]![Company] = Forms![ValueForm]![CompanyName]

where [Vals] is the name of the Table associated with my form. [Company] is
the column in the table I need updated, [ValueForm] is the form I'm working
in and [CompanyName] is the name of the textbox which has its control source
set to the DLookup function.

Any help?

Bob said:
Your data doesn't save to the table because the control is
bound to the DLookup function and not the table. To save
to the table you'll have to set the control equal to what
you want it to save in the table through VBA or a macro.
You can use the "Set Value" action in a macro or use code
in the "OnChange" event of the combobox something like:

[YourTargetControl] = [YourDesiredValue]
-----Original Message-----
I had a question a week ago about automatically populating a text-box with
data from a table that I have. The form has a combo box for "Formula", and
when the user selects the item from the combo box, then two text-boxes for
"Company" and "Product Code" are automatically filled in. I did this by using
a DLookUp(The DLookup looks at a table with 3 column in it). I placed the
Dlookup function in the control source. The problem now is: THE DATA DOESN'T
SHOW UP IN THE TABLE ASSOCIATED WITH THE FORM???? What do I do?


.
 
okay, figured it out. Macro worked great.

Andre Grujovski said:
Okay, I'm a little confused. First of all. The value in the comboBox IS
updated in the table, obviously because the comboBox's control source is
fine, because its the corresponding field in the table. The problem arises in
the Text Boxes, their control source is the DLookUp function that uses the
value in the comboBox to populate themselves.

Does this change your answer at all??? Because I tried going into the
textBoxes properties and changed the event "OnChange" to:

[Vals]![Company] = Forms![ValueForm]![CompanyName]

where [Vals] is the name of the Table associated with my form. [Company] is
the column in the table I need updated, [ValueForm] is the form I'm working
in and [CompanyName] is the name of the textbox which has its control source
set to the DLookup function.

Any help?

Bob said:
Your data doesn't save to the table because the control is
bound to the DLookup function and not the table. To save
to the table you'll have to set the control equal to what
you want it to save in the table through VBA or a macro.
You can use the "Set Value" action in a macro or use code
in the "OnChange" event of the combobox something like:

[YourTargetControl] = [YourDesiredValue]
-----Original Message-----
I had a question a week ago about automatically populating a text-box with
data from a table that I have. The form has a combo box for "Formula", and
when the user selects the item from the combo box, then two text-boxes for
"Company" and "Product Code" are automatically filled in. I did this by using
a DLookUp(The DLookup looks at a table with 3 column in it). I placed the
Dlookup function in the control source. The problem now is: THE DATA DOESN'T
SHOW UP IN THE TABLE ASSOCIATED WITH THE FORM???? What do I do?


.
 
Back
Top