|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie: Year( ) function doesnt work !this is very weird!! Neither Year(myDate) nor myDate.Year work!! I have VB 6 with all latest updates as far as I know. I Used this, taken straight from MSDN: Dim MyDate, MyYear MyDate = #10/19/1962# ' Assign a date. MyYear = Year(MyDate) ' MyYear contains 1962 MsgBox (MyYear) And it complains! BTW I typed the Y as capital and VB makes it a small . However, when i type: VBA.Year(MyDate) I get the correct answer . Also .year doesnt work : Mydate.year also complains. Some sort of DLL I have to add ?? I could keep using VBA. as a prefix but its annoying and i want to understand whats happening. Thanx for any help in advance! -steve smith wrote:
Show quoteHide quote > Hi, So check within your code what you have named, "year". Perhaps a variable> this is very weird!! > Neither Year(myDate) nor myDate.Year work!! > > I have VB 6 with all latest updates as far as I know. > > I Used this, taken straight from MSDN: > > Dim MyDate, MyYear > MyDate = #10/19/1962# ' Assign a date. > MyYear = Year(MyDate) ' MyYear contains 1962 > MsgBox (MyYear) > > And it complains! BTW I typed the Y as capital and VB makes it a > small . > > However, when i type: VBA.Year(MyDate) I get the correct answer . somewhere... -- Regards, Michael Cole I am embarassed......!!!!! :(
Thank you for your help! Show quoteHide quote "Michael Cole" <no***@hansen.com> wrote in message news:O81TjpUzFHA.3312@TK2MSFTNGP09.phx.gbl... > smith wrote: >> Hi, >> this is very weird!! >> Neither Year(myDate) nor myDate.Year work!! >> >> I have VB 6 with all latest updates as far as I know. >> >> I Used this, taken straight from MSDN: >> >> Dim MyDate, MyYear >> MyDate = #10/19/1962# ' Assign a date. >> MyYear = Year(MyDate) ' MyYear contains 1962 >> MsgBox (MyYear) >> >> And it complains! BTW I typed the Y as capital and VB makes it a >> small . >> >> However, when i type: VBA.Year(MyDate) I get the correct answer . > > So check within your code what you have named, "year". Perhaps a variable > somewhere... > > -- > Regards, > > Michael Cole > > smith wrote:
> I am embarassed......!!!!! :( Don't worry, you are not alone.One of the best I heard was someone calling a variable, "mID", which of course meant that the Mid function didn't work. Most of us would have done something like that at some time in our life. Show quoteHide quote > > Thank you for your help! > > > "Michael Cole" <no***@hansen.com> wrote in message > news:O81TjpUzFHA.3312@TK2MSFTNGP09.phx.gbl... >> smith wrote: >>> Hi, >>> this is very weird!! >>> Neither Year(myDate) nor myDate.Year work!! >>> >>> I have VB 6 with all latest updates as far as I know. >>> >>> I Used this, taken straight from MSDN: >>> >>> Dim MyDate, MyYear >>> MyDate = #10/19/1962# ' Assign a date. >>> MyYear = Year(MyDate) ' MyYear contains 1962 >>> MsgBox (MyYear) >>> >>> And it complains! BTW I typed the Y as capital and VB makes it a >>> small . >>> >>> However, when i type: VBA.Year(MyDate) I get the correct answer . >> >> So check within your code what you have named, "year". Perhaps a >> variable somewhere... >> >> -- >> Regards, >> >> Michael Cole -- Regards, Michael Cole Think that is bad.
I like to name my variables with a prefix indicating type. So my string variable for the top of something is sTop And it does. Show quoteHide quote "Michael Cole" wrote: > smith wrote: > > I am embarassed......!!!!! :( > > Don't worry, you are not alone. > One of the best I heard was someone calling a variable, "mID", which of > course meant that the Mid function didn't work. Most of us would have done > something like that at some time in our life. > > > > > Thank you for your help! > > > > > > "Michael Cole" <no***@hansen.com> wrote in message > > news:O81TjpUzFHA.3312@TK2MSFTNGP09.phx.gbl... > >> smith wrote: > >>> Hi, > >>> this is very weird!! > >>> Neither Year(myDate) nor myDate.Year work!! > >>> > >>> I have VB 6 with all latest updates as far as I know. > >>> > >>> I Used this, taken straight from MSDN: > >>> > >>> Dim MyDate, MyYear > >>> MyDate = #10/19/1962# ' Assign a date. > >>> MyYear = Year(MyDate) ' MyYear contains 1962 > >>> MsgBox (MyYear) > >>> > >>> And it complains! BTW I typed the Y as capital and VB makes it a > >>> small . > >>> > >>> However, when i type: VBA.Year(MyDate) I get the correct answer . > >> > >> So check within your code what you have named, "year". Perhaps a > >> variable somewhere... > >> > >> -- > >> Regards, > >> > >> Michael Cole > > -- > Regards, > > Michael Cole > > > "Lorin" <Lo***@discussions.microsoft.com> wrote in message ROFL!news:2835F0B4-1F23-4176-B0A6-D2B1A07DA053@microsoft.com... > > Think that is bad. > I like to name my variables with a prefix indicating type. > So my string variable for the top of something is sTop > And it does. > Thank you, thank you. I'm the clown that got burnt with "mID". At least in your case the error showed up rather quickly. <g> -ralph Show quoteHide quote > "Michael Cole" wrote: > > > smith wrote: > > > I am embarassed......!!!!! :( > > > > Don't worry, you are not alone. > > One of the best I heard was someone calling a variable, "mID", which of > > course meant that the Mid function didn't work. Most of us would have done > > something like that at some time in our life. > > > > > > > > Thank you for your help! > > > > > > > > > "Michael Cole" <no***@hansen.com> wrote in message > > > news:O81TjpUzFHA.3312@TK2MSFTNGP09.phx.gbl... > > >> smith wrote: > > >>> Hi, > > >>> this is very weird!! > > >>> Neither Year(myDate) nor myDate.Year work!! > > >>> > > >>> I have VB 6 with all latest updates as far as I know. > > >>> > > >>> I Used this, taken straight from MSDN: > > >>> > > >>> Dim MyDate, MyYear > > >>> MyDate = #10/19/1962# ' Assign a date. > > >>> MyYear = Year(MyDate) ' MyYear contains 1962 > > >>> MsgBox (MyYear) > > >>> > > >>> And it complains! BTW I typed the Y as capital and VB makes it a > > >>> small . > > >>> > > >>> However, when i type: VBA.Year(MyDate) I get the correct answer . > > >> > > >> So check within your code what you have named, "year". Perhaps a > > >> variable somewhere... > > >> > > >> -- > > >> Regards, > > >> > > >> Michael Cole > > > > -- > > Regards, > > > > Michael Cole > > > > > >
.NOT My Views
How should one form call another? RESET does what? Why can't I test class functions from the Immediate window? advanced tooltip bubbles question Reverse Array order ? Cannot Load Form! Activex Exe How to handle data types in custom Max/Min function? Point me in the right direction - Mouse utility... |
|||||||||||||||||||||||