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!

Capturing current month problem

Status
Not open for further replies.

genxiii

Technical User
Jun 13, 2003
17
US
Hey guys,

Hoping if someone can explain this to me and why i'm having a problem.

I have a form that is bound to a table. I'm using VBA to capture and store the integer # of the current month. When I run it though I keep getting the error message "Type Mismatch".

Here's my code.

Dim intMonth as integer

intMonth = Month(Now())


i get a type mismatch error when i use the month() function but not the Day() or Year().

HOWEVER when i make the form so that it is not bounded to a table the month() function works. Does anyone know why i have this problem and how i can get around it? I'm using Access 97
 
Hi, code seems fine to me. What else is named Month? Perhaps a field in the table the form is bound to? Just gessing here.
 
yeah, you were right, i totally missed that. i have a field called month that that form was bounded to so it kept refering to that field instead of the month fuction. i can't believe i overlooked that. thanks a lot. problem solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top