Strange unbound control problem

  • Thread starter Thread starter swarfmaker
  • Start date Start date
S

swarfmaker

Access 2003 on WindowsXP Pro SP2

If I put the following expression into an unbound control:
=Trim("Training between "&Format(Now()"d mmmm yyyy")&" &
"&Format((Now()+30),"d mmmm yyyy")

I get the following result:

Between 8 July 2008 & 7 Augu23t 2008

The figures embedded in "August" change every time the report is run.

There are no missing references and the database compiles properly.

Any ideas?

Iain.
 
Access 2003 on WindowsXP Pro SP2

If I put the following expression into an unbound control:
=Trim("Training between "&Format(Now()"d mmmm yyyy")&" &
"&Format((Now()+30),"d mmmm yyyy")

I get the following result:

Between 8 July 2008 & 7 Augu23t 2008

The figures embedded in "August" change every time the report is run.

There are no missing references and the database compiles properly.

Any ideas?

Iain.

Why do you need the Trim() function here?
You're missing a comma in the first Format argument position.
V
Format(Now()"d mmmm yyyy")

You don't need the extra set of parenthesis in the
V V
Format((Now()+30), d mmmm yyyy") expression.

Now() includes a time value, which you are not using here.
Use Date() instead.

=Trim("Training between " & Format(Date(),"d mmmm yyyy") & " & " &
Format(Date()+30,"d mmmm yyyy"))
 
Try this --
=Trim("Training between " &Format(Date(),"d mmmm yyyy")&" &
"&Format((Date()+30),"d mmmm yyyy"))
 
fredg said:
Why do you need the Trim() function here?
You're missing a comma in the first Format argument position.
V
Format(Now()"d mmmm yyyy")

You don't need the extra set of parenthesis in the
V V
Format((Now()+30), d mmmm yyyy") expression.

Now() includes a time value, which you are not using here.
Use Date() instead.

=Trim("Training between " & Format(Date(),"d mmmm yyyy") & " & " &
Format(Date()+30,"d mmmm yyyy"))

I still get the same result with these changes.
Also, if I change the & within the Quote marks to "and" that displays the
same behaviour i.e. a mixture of letters and numbers.

Iain
 
I still get the same result with these changes.
Also, if I change the & within the Quote marks to "and" that displays the
same behaviour i.e. a mixture of letters and numbers.

Iain

You're telling us what you did, but you're not showing us.
Please copy and paste the exact control source expression you are
using. Do NOT just re-type it.
 
fredg said:
You're telling us what you did, but you're not showing us.
Please copy and paste the exact control source expression you are
using. Do NOT just re-type it.

Hi Fred,
Here is the expression copied and pasted
=Trim("Training scheduled to commence between " & Format(Date()+1,"d mmmm
yyyy" & " & " & Format(Now()+30,"d mmmm yyyy"))
This gives me: "Training scheduled to commence between 11 July 2008 & 9
Augu0t 2008"

If I try this:
=Trim("Training scheduled to commence between " & Format(Date()+1,"d mmmm
yyyy" & " and " & Format(Now()+30,"d mmmm yyyy")))
I get: "Training scheduled to commence between 11 July 2008 a011 9 augu0t
2008"

Any ideas?

Iain
 
Try the following

=Trim("Training scheduled to commence between " & Format(Date()+1,"d mmmm
yyyy") & " and " & Format(Now()+30,"d mmmm yyyy"))

You had your parentheses in the wrong places
=Trim("Training scheduled to commence between " & Format(Date()+1,"d mmmm
yyyy" ^^^ need one here ^^^ & " and " & Format(Now()+30,"d mmmm yyyy"))^^^ one
extra one here ^^^)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top