MonthName Help Example Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated name.
MsgBox(Name) ' Name contains "Apr".
 
Bob said:
I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can
not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated
name.
MsgBox(Name) ' Name contains "Apr".

Qualify the function's name with the module containing it
('DateAndTime.MonthName').
 
i think you have the problem in another place... i try the code and works
just fine!
 
I found out what the probelm was. When I created the project I named it
MonthName instead of MonthNameDemo. SO the project name and the function were
named the same.
 
Bob said:
I found out what the probelm was. When I created the project I named it
MonthName instead of MonthNameDemo. SO the project name and the function
were
named the same.

ACK. By default the project's root namespace has the name of the project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top