Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello,

Cannot see a way of doing this without using a macro. When the selection is made from the listbox, trigger an On change event to execute the macro. The macro then uses the selected item in the listbox and with SQL retrieves the associated Unit price and moves it into the proper field on your form. Specifics on this are dependent upon form and table names.

Still don't agree with this process as it seems to possibly lead to more mistakes/problems. I can, however, see a field which overrides the standard price. I can also see different levels in Services.UnitPrice based on quantity.

Hello,

Cannot see a way of doing this without using a macro. When the selection is made from the listbox, trigger an On change event to execute the macro. The macro then uses the selected item in the listbox and with SQL retrieves the associated Unit price and moves it into the proper field on your form. Specifics on this are dependent upon form and table names.

Still don't agree with this process as it seems to possibly lead to more mistakes/problems. I can, however, see a field which overrides the standard price. I can also see different levels in Services.UnitPrice based on quantity.

Hello,

Cannot see a way of doing this without using a macro. When the selection is made from the listbox, trigger an On change event to execute the macro. The macro then uses the selected item in the listbox and with SQL retrieves the associated Unit price and moves it into the proper field on your form. Specifics on this are dependent upon form and table names.

Edit 2/9/18:

Seeing on how this is a bit of a communication problem, I have put together a sample loosely based upon your information. It is the more difficult of the possibilities - a table control. It is more difficult because you cannot depend upon the conventional "Event" triggers to update the fields. For example, if you are on line #1 of the table & listbox = selection "A" & no changes are made on line #1 but you move to line #2 where that listbox = selection "B" that will trigger an 'Item Status Changed' event. There are even more of these situations when dealing with a table control.

To get around that situation, anytime a different record is selected its' data is saved in Global variables. Then if changes have been made to the record, the before updating event is triggered. The data is compared to the original and when warranted the unit price is modified.

Of course this is an even more simple process if individual fields were used instead of a table control. In that case only a single macro would be needed as there would be no jumping from record to record.

Sample - CopyField.odb

If this answers your question please tick the ✔ (upper left area of answer). It helps others to know there was an accepted answer.