convert number into month

Z

zyus

I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query
 
G

George

Try the following,

Create a query base on your table (Table1 in my example) and use the
followingQ

NewDate: DateAdd("m";[Table1]![mynumber];[Table1]![mydate])
where, Table1 is your tablename,
MyNumber is your num field and
Mydate is your RelDate field,

Hope this will help,

GeorgeCY

Ο χÏήστης "zyus" έγγÏαψε:
I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

UpRider said:
That's pretty vague. Spend a few seconds more to explain what you want....

UpRider
 
Z

zyus

Tried but return invalid syntax....

George said:
Try the following,

Create a query base on your table (Table1 in my example) and use the
followingQ

NewDate: DateAdd("m";[Table1]![mynumber];[Table1]![mydate])
where, Table1 is your tablename,
MyNumber is your num field and
Mydate is your RelDate field,

Hope this will help,

GeorgeCY

Ο χÏήστης "zyus" έγγÏαψε:
I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

UpRider said:
That's pretty vague. Spend a few seconds more to explain what you want....

UpRider

How to convert number into month,

say 1, as 1 month

TQ
 
G

George

Try this,

NewDate: DateAdd("m",[Table1]![mynumber],[Table1]![mydate])

I have changed all ; with ,


Ο χÏήστης "zyus" έγγÏαψε:
Tried but return invalid syntax....

George said:
Try the following,

Create a query base on your table (Table1 in my example) and use the
followingQ

NewDate: DateAdd("m";[Table1]![mynumber];[Table1]![mydate])
where, Table1 is your tablename,
MyNumber is your num field and
Mydate is your RelDate field,

Hope this will help,

GeorgeCY

Ο χÏήστης "zyus" έγγÏαψε:
I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

:

That's pretty vague. Spend a few seconds more to explain what you want....

UpRider

How to convert number into month,

say 1, as 1 month

TQ
 
J

John W. Vinson

I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

DateAdd("m", 1, [reldate])
 
Z

zyus

Num is a separate field and the number range from 1 to 999. Based on your
expression does it take into account this num field.

TQ

John W. Vinson said:
I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

DateAdd("m", 1, [reldate])
 
Z

zyus

It works perfectly....Thanks George

George said:
Try this,

NewDate: DateAdd("m",[Table1]![mynumber],[Table1]![mydate])

I have changed all ; with ,


Ο χÏήστης "zyus" έγγÏαψε:
Tried but return invalid syntax....

George said:
Try the following,

Create a query base on your table (Table1 in my example) and use the
followingQ

NewDate: DateAdd("m";[Table1]![mynumber];[Table1]![mydate])
where, Table1 is your tablename,
MyNumber is your num field and
Mydate is your RelDate field,

Hope this will help,

GeorgeCY

Ο χÏήστης "zyus" έγγÏαψε:

I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

:

That's pretty vague. Spend a few seconds more to explain what you want....

UpRider

How to convert number into month,

say 1, as 1 month

TQ
 
J

John W. Vinson

Num is a separate field and the number range from 1 to 999. Based on your
expression does it take into account this num field.

TQ

John W. Vinson said:
I hv this data

Num Reldate
1 01-01-08
3 01-02-08
2 01-03-08
4 01-04-08

I want to take Num as month coz what i intend to do is to add
[reldate]+[num] so i could get newdate of 01-02-08 for 1st record and
01-05-08 for 2nd record and so forth...

Will i be able to do that in my query

DateAdd("m", 1, [reldate])

Just us [Num] instead of 1 in the DateAdd expression. You'll need some way
(which will depend on the context) to determine which reldate you're referring
to. I presume (you don't say!) that the reldate field is day-month-year? If
so, then either [Num] or [Reldate] *SHOULD NOT EXIST* in your table, as you
can determine the value of one given the other; they're redundant. Store
either one or the other and calculate the non-stored one as needed.

Since I don't know the context or the use to which this table will be put,
take this advice with appropriate caution!
 

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

Similar Threads


Top