Error 3075

  • Thread starter Thread starter David McKnight
  • Start date Start date
D

David McKnight

I get a error message when I add the following to code to build a query:

"IIf(Format([Scores].[Date],'ww')="",54,Format([Scores].[Date],'ww')) AS
Week "

It runs fine as part of a query design but not as code in a form.

It works in the code if I remove the IIF statement
 
Try using a different alias than Week (for that matter, consider renaming
your table field something other than Date). Both Week and Date are reserved
words, and you should never use reserved words for your own purposes.

For a comprehensive list of names to avoid (as well as a link to a free
utility to check your application for compliance), see what Allen Browne has
at http://www.allenbrowne.com/AppIssueBadWord.html
 
The [Scores] part of the expression refers to a table name in your query.
When using that code on a form, make it point to the textbox that holds that
data.


IIf(Format(Me.TxtDate,'ww')="",54,FormatMe.txtDate,'ww')) AS
Week
 
Back
Top