Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Hello

Can anyone help

The following code is executed on an after update event on my form
Forms![Cost Authorisation Preparation Form]![Year of Applicaton] = Year(Now())
It was working fine and now I am getting a type mismatch message
The format of the [year of application] control on the form is set to text on the underlying table and I can only assume that trying to set the text control to year (now()) is the cause of the problem although I'm not sure how it worked beforeI really would like to keep the control set to text and it is used in other queries in my DB so perhaps I need to convert year now to a string?

Unless of course there is another reason

As usual any help would be appreciated
Thanks
 


Hi,

Maybe...
Code:
Forms![Cost Authorisation Preparation Form]![Year of Applicaton] = CStr(Year(Now))

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Many thanks

Have tried using this and get the same problem so if you have any other ideas then would appreciate it
 
Dear skipvought

Have solved my problem using the following code

Me.Year_of_Applicaton = VBA.Year(Now())

Many thanks for your help
 
Seems like you have an object named Year ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top