Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 22nd, 2008, 06:24 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rolling headers (13 months) how to update records

Hi,

I have been struggling with ADODB to solve this:
1. I create a table with solid row data and headers.
2. I update the last 13 column headers with rolling months as below.

Sub SetMyColumns()
Dim myConn
Dim tbl, newCol, adox, n

Set myConn = CurrentProject.Connection

    tbl = "MyTable"

    Set adox = CreateObject("ADOX.Catalog")
    adox.ActiveConnection = myConn
    For n = 0 To 12
    newCol = Year(DateAdd("m", n, (Now()))) & "-" & Right(0 & Month(DateAdd("m", n, Now())), 2)
    adox.Tables(tbl).Columns("M+" & n).Name = newCol
    adox.Tables.Refresh
    Next
    Set adox = Nothing
    myConn.Close
    Set myConn = Nothing

End Sub

3. Until now I'm fine, but then:
- I'm picking values from another table along with month number and need to place this data by matching month into "MyTable".

The problem is how to save the source data (myValue) to "MyTable" to correct columns? myData connects nicely to "MyTable" but I cannot use it like this (get error msg):

Do Until myData.EOF

from 0 to 12
myData!rollCol = myValue/13 <== This fails!!
(here I set next month to rollCol)
next

Loop

rollCol points to actual month to actual+12 months
e.g. 2008-05, 2008-06, 2008-07 .....2009-05

I have not set any specific Dimension for rollCol, should I?

Thanks in advance
Axxess






Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lets get this forum rolling! SQLScott Windows Communication Foundation 6 August 9th, 2011 10:01 PM
Update Multiple Records cancer10 Classic ASP Databases 0 October 25th, 2006 01:01 AM
Update Records bspeck Dreamweaver (all versions) 5 October 5th, 2004 03:05 PM
UPDATE RECORDS!!! a_pathak BOOK: Beginning ASP 3.0 1 March 3rd, 2004 04:00 AM
Help! Cannot update records mcalder Classic ASP Databases 6 August 14th, 2003 01:54 PM



All times are GMT -4. The time now is 01:30 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.