Value to an unbound field

  • Thread starter Thread starter Dimitris Nikolakakis
  • Start date 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
 
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 & "'"
 
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

Similar Threads

auto value in a field 1
requery 2
requery in subform 1
Combo box requery 1
Totals Query hard to figure out 4
Re: Pass field value selected in Combo Box to SQL Query 1
Query an unbound field 0
strange problem 1

Back
Top