Expression builder & Selection Boxes

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I use macros to transfer data from one form to another.
This works great until I try to transfer data from a
selection box in one form to a text field in another
form. When the macro transfers the data using the
setvalue command, it puts the selection number instead of
the actual text associated with it. Is there any way in
expression builder to "look up" the selection in a table
and paste the actual text? Example: "[Vendor Information]!
[Vendor Number] ([Forms]![Purchase Order]![Vendor Name].
[ControlSource])" where "[Vendor Information]![Vendor
Number]" is the table with the vendor information in it,
and "[Forms]![Purchase Order]![Vendor Name].
[ControlSource]" is the field in the form that I am
trying to copy from.
 
Richard,

It sounds like you have a control on the Purchase Order form which is
named Vendor Name but is bound to the Vendor Number field. Is this
correct? You could try something like this...
DLookup("[Vendor Name]","Vendor Information","[Vendor Number]=" &
[Vendor Name])

I am bound to say that what you are doing is very unusual, and probably
reflects a design problem in your database.

Having said that, there are probably easier ways to achieve this type of
purpose, for example by using an Append Query or an Update Query, rather
than SetValue actions in a macro.
 
Back
Top