Re: Incrementing a month value

From: Mark White (anonymous_at_discussions.microsoft.com)
Date: 05/28/04


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
     
     
     



Relevant Pages

  • Re: Set A Parameter Without Redirecting A Page?
    ... Mark Fitzpatrick wrote: ... using AJAX because then you wouldn't be posting back the whole page. ... I am trying to set a parameter - ResponseId = 4 inside a while loop. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Creating variables in a loop!
    ... Mark, thanks for the response, I appreciate it. ... retrieve the information back from the ... of the loop and doesn't exist outside it. ... CheckBox chk = new CheckBox; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: More STL questions
    ... > Mark P wrote: ... >>My concern in this situation is that every time I execute the for loop ... >>within the loop, and expecting it to be safely available in mySet during ... > When you ask an STL container to add something to it, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Async thread not freeing up UI
    ... What do I do with Queue? ... >> Private Sub AB_Click(ByVal sender As System.Object, ... >> threading logic works fine with a local function that simply runs a loop ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Incrementing a month value
    ... then runs a loop that the user inputs a number of months ... and a starting Transaction Date. ... > This loop writes a SQL statement to populate the table with two fields: ... if TA# is a text field, enclose strTA with single quotes as below (I ...
    (microsoft.public.access.modulesdaovba)