Function is not available

  • Thread starter Thread starter Paul Henderson
  • Start date Start date
P

Paul Henderson

I have created a database in Access 2002 which works fine
on my desktop machine, but when I transfer it to my
laptop (also running Access 2002) I get the following
message box appear when I try to open some of the forms:

Function is not available in expressions in query
expression 'IIf([DateApprox?]=Yes,Format
([DateOfPhotograph],"mmmm yyyy") & " approximately",Format
([DateOfPhotograph],"dddd"", ""d mmmm"", ""yyyy"))'

[DateApprox?] Is a yes/no field and [DateOfPhotograph] is
a date/time field.

This expression, which is embedded in text boxes on some
of my forms works on my desktop machine. I have re-
installed Access, but to no avail. What should I do to
make it work on my laptop please? Thank you in
anticipation.
 
Usually you have a lot of trouble in Access when the there is a attribute in
the datasource and a control on the form with the same name, especially when
doing something special. Try naming these different, this could be the
problem.

Otherwise resort to VB code, make a module, place the below expression in a
simple function and call this function.

Function FormatDateApprox(Approx as boolean, PhotoDate as date) As String
' in VB, just never use that scarry iif thing, its inefficient and
completely unreadable!
if Approx then
FormatDateApprox = Format(PhotoDate,"mmmm yyyy") & " approximately"
else
FormatDateApprox = Format(PhotoDate,"dddd"", ""d mmmm"", ""yyyy")
end if
End Function

expression: FormatDateApprox([DateApprox?], [DateOfPhotograph])

This makes fault isolation also a lot easier and formatting code better
reusable...

- Joris
 
Back
Top