Forms in SQL

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

I am trying to get this part of the SQL to work properly
and I'm not sure how to handle this where it refers to a
specific text box in a form. The text box is
called "date2".

If I was to substitute Forms]![frm]![date2] with a date
of '11/14/2003' the SQL would run properly but this
section is causing it to fail. Below is the entire line
which needs to be corrected.



WHERE a.DB146_SALES_DT=[Forms]![frm]![date2]

Thanks for any help you can provide!!

Craig
 
Try this string instead:

WHERE a.DB146_SALES_DT=[Forms]![frm]!date2.value

Note that if the contents of the text box are not numeric this will not
always work, i.e. if the contents of the textbox are text then you should
use the text property of the textbox: date2.text

The bracketing around the object references should be automagically added by
Access where it needs it (as below), I frequently skip typing it rather than
risk putting them in the wrong place. The exclamation point does the job.

WHERE a.DB146_SALES_DT=[Forms]![frm]![date2].[value]
 
Back
Top