form field reference

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have an update query in which the update will be based
on the specific date that is entered in a date field on a
form

then the criteria for the same update is based on another
date field on the same form.

Question: What is the proper way to reference a form
field within a query?
 
That is the way I orignally set it up - but it does not
acknowledge the entry - have rechecked all aspects.
Keeps popping up the parameter request instead of
accepting the input into the field.
-----Original Message-----
[Forms]![YourForm]![YourControl]

--
HTH
Van T. Dinh
MVP (Access)



John said:
I have an update query in which the update will be based
on the specific date that is entered in a date field on a
form

then the criteria for the same update is based on another
date field on the same form.

Question: What is the proper way to reference a form
field within a query?


.
 
Do you have the Form already opened when the Query is executed?
You need the Form open as the Control & its value doesn't exist if the Form
is not open.

Do you run the Query by VBA code, e.g. creating a Recordset based on the
Query?
If this is the case, you need to resolve the reference to the Control before
passing the Query / SQL String to JET for execution. This is different from
running a Query using the GUI (i.e. Query-By-Example interface) since in
this case, the Expression Service automatically steps in and resolve the
reference to the Form Control before passing the SQL String to the Database
Engine for execution.

You can use the Parameters Collection of the QueryDef Object to resolve the
reference to the Form Control (which is a Parameter in the Query).
 
Back
Top