I have a form named frmVehicleEntryForm. It has a 3-tab tab control.
On the 2nd tab page, there's a textbox named VehicleLocationName
whose default value setting is
=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")
The criteria of the DLookUp points to a control on tab page 1. If,
after choosing a company in TowCoDropDownBox, I click tab page 2,
I was hoping to see something like "XYZ Company" in the textbox named
VehicleLocationName. But I don't.
Oddly, if I change VehicleLocationName.DefaultValue property to
=DLookUp("[TowCompany]","tblAdmin")
I get what I want. A company shows up. Of course, its the first
company in the table. And most of the time, that's wrong - I have
35 different companies in that table.
The key seems to be the dlookup criteria. If there is no criteria,
Access looks up the value and puts it in the field. This is a data
entry form. Perhaps something I type into a control really isn't there
- at least not in the way Access wants it to be there when attempting
to READ the contents. Form properties AllowEdits, AllowDeletions,
AllowAdditions and DataEntry are all Yes.
Can I revise my criteria in the DLookUp to overcome my problem? Or,
should I not be trying to read what's in the field at all?