Re: Incrementing a month value
From: Mark White (anonymous_at_discussions.microsoft.com)
Date: 05/28/04
- Next message: Graham R Seach: "Re: Catch errors on append query"
- Previous message: Joe Black: "Re: Incrementing a month value"
- In reply to: Joe Black: "Re: Incrementing a month value"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 27 May 2004 19:26:05 -0700
Thanks Joe,
The inclusion of the Value procedure was a great help. Fixed
cheers
Mark
----- Joe Black wrote: -----
"Mark White" <anonymous@discussions.microsoft.com> wrote in message
news:39A918D6-69EC-45B2-B452-CBF9CB109D27@microsoft.com...
> I have written a module in Access 2000 with DAO 3.6 referenced, that
creates a Table, then runs a loop that the user inputs a number of months
that depreciation will be applied, and a starting Transaction Date.
>> This loop writes a SQL statement to populate the table with two fields: a
Transaction Number, and a Transaction Date: strSQL = "INSERT INTO
Ass2Depcn ( [TA#], TADate )SELECT " & strTA & " AS [TA#], " &
Format(datTADate, "Short Date") & " AS TADate;"
>> With each loop I have used the stored procedure DateAdd to increase the
next statement by one month:
> datTADate = DateAdd("m", 1, datTADate)
>>> When I run this in the immediate window I get the correct result (NB I am
an Aussie), ie.
> 1 31/12/2003
> 2 30/1/2004
> 3 28/2/2004
>> But when I run the module into the table I get the date field decreasing
in value starting at 1/1/1900 and by seconds at a time. Even though the
table is formatted to display in Short Date, it displays time values.
>> Hope you can help, thanks in advance
Hi Mark
try (text will wrap)
strSQL = "INSERT INTO Ass2Depcn ( [TA#], TADate ) VALUES (" & strTA & ", #"
& Format(Date, "d mmmm yyyy") & "#);"
if TA# is a text field, enclose strTA with single quotes as below (I
wondered about this since you store the TA# in strTA (string?) which is
strange if TA# is a numeric field)
strSQL = "INSERT INTO Ass2Depcn ( [TA#], TADate ) VALUES ('" & strTA & "',
#" & Format(Date, "d mmmm yyyy") & "#);"
Regards - Joe
- Next message: Graham R Seach: "Re: Catch errors on append query"
- Previous message: Joe Black: "Re: Incrementing a month value"
- In reply to: Joe Black: "Re: Incrementing a month value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|