Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lorraine Stephens   on Mar 01 In MS Office Category.

  
Question Answered By: William Evans   on Mar 01

I think that there’s something wrong with your email as it seems to have
truncated lines in it.

The FORMAT function needs something to format.
The syntax is well documented in the help and is...

StringVariable = Format(expression[, format[, firstdayofweek[,
firstweekofyear]]])

Where the expresion is a gives a date  and the format is a string.

For example StringVariable=Format(Now(),"dd/mm/yy")

... Will return the current date as, for example, "01/05/07" for the 1st of
March.

You can also use string variables for the format part and format numbers and
strings as well as dates.

To "adjust" part of your code ....
> Private Sub cmbOK_Click(P
> Dim varSeasonAge As Date
> Dim varJnrSeasonAge As Date
> Dim varSeasonDate As String
> Dim varJuniorDate As String
> Dim varDateOfBirth As String
>
> Dim varResultDate as string
>
>
> varSeasonDate = "DD / MM / YYYY)"
> varJuniorDate = "DD / MM / YYYY"
> varDateOfBirth = “DD / MM / YYYY”
>
> varSeasonDate = #01/09/2006#
> varJuniorDate = #01/01/2007#
>
> varResultDate = Format(varSeasonDate ,varSeasonDate)
> varResultDate = Format(varJuniorDate ,varJuniorDate)

Note that the function returns a string and needs a string for the “pattern”
and also that dates  are entered  with hashes around them. I’ve not tested the
above but I’m sure it will work.

What are you trying to actually do again please?

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on US/UK Date conflict Or get search suggestion and latest updates.


Tagged: