Hello,
I need to place into a textbox of a form the current month such as 10 for october 11 for november when I update a database. I also need to place into another textbox the current year. Can anyone help?
Printable View
Hello,
I need to place into a textbox of a form the current month such as 10 for october 11 for november when I update a database. I also need to place into another textbox the current year. Can anyone help?
Text1.Text = Format(Now(), "mm")
Text2.Text = Format(Now(), "yy") ' or "YYYY"
This is what I have now. I get a "Sub or Function not defined" error.
VB Code:
txtfield(3) = Format(Now(), "mm") txtfield(4) = Format(Now(), "yyyy")
Assuming that txtfield(3) and txtfield(4) are two textboxes in a control array, your code should be OK. What is highlighted when you get the error?
Are your textboxes named txtfield or txtfields or something else? If the name wasn't correct you'd get that error.
Maritin, You were right, I forgot the "s" in txtfields.
Thanks