Control does not refresh

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have tried creating a form where the user enters an id number in Control A
and a second control B displays the name associated with the value in Control
A. A combi box to lookup the number is not acceptable - the user has to type
in the number.

The id is held in table C and the name in table D. If I create a query
MyQuery with Control A as the criterion it returns the correct name when I
run it but if I paste the SQL into the ControlSource of Control B it does not
update.

I have tried adding a requery or refresh statement to the OnUpdate event of
Control A but it doesn't work. I've also tried creating a form with MyQuery
as the RecordSource and then creating a control based on the site name field
but still no luck.

The only way I can get it to work is to put the statement
=Dmax("[Site_Name]","MyQuery") in the ControlSource of Control B and to add a
Requery statement to the OnUpdate event of Control A.

It all seems terribly complicated to achieve something apparently so simple.

Any ideas?
 
Hi,


A SQL statement cannot be a CONTROL source, in general... consider that a
SQL statement can contain multiple columns (to fit in a single control) and
multiple rows (again, to fit in a single edit text box). Using

=DLookup( ... )

is thus a solution, or DMax, if you want, and if applicable.

A Me.Recalc, like [F9] function key, should be sufficient, rather than
requerying the form (requery moves you to the first record of the
recordset).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top