Value to an unbound field

  • Thread starter Dimitris Nikolakakis
  • Start date
D

Dimitris Nikolakakis

I have a form FORDERS that takes data from table ORDERS

One field of this form is FactoryID.

I have an unbound field named SentTo and I want to automatically give the
value of Factories.E-mail (field of table FACTORIES) based on the field
FactoryID of the form.

The above form opens from a command button of a form and shows only one
record (FILTER) when loaded.

Thanks
 
W

Wayne Morgan

You will need the FactoryID field in the Factories table to do this. Set the control
source of the unbound textbox to

=DLookup("[E-mail]", "Factories", "[FactoryID] = " & Forms!FORDERS!txtFactoryID

if the FactoryID is text instead of numeric

=DLookup("[E-mail]", "Factories", "[FactoryID] = '" & Forms!FORDERS!txtFactoryID & "'"
 
H

Howard Brody

Use a DLookUp when your form loads:

Dim strFID as String
Dim strFEmail as String

strFID = [FactoryID]
strFEmail = DLookUp("[E-mail]","FACTORIES","[FactoryID]='"
& strFID & "'")
[SentTo] = strFEmail

Check the Help files for more details on DLookUps.

Hope this helps!

Howard Brody
 

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

Top