Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying dates

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi everyone

I have a really simple module written in VBA as a module in Access. The module just searches for every date in the database and updates it by a set number of months. Here is the code:

Option Compare Database
Option Explicit

Sub Main()

Dim DB As Database, TB As TableDef, FD As Field, SQL As String

Set DB = CurrentDb
For Each TB In DB.TableDefs
If TB.Name <> &quot;CognosData&quot; And TB.Name <> &quot;CustomerCodedInformation&quot; And TB.Name <> &quot;Logins&quot; And TB.Name <> &quot;TimePeriod&quot; And Left$(TB.Name, 4) <> &quot;MSys&quot; Then
For Each FD In TB.Fields
If FD.Type = dbDate Then
If FD.Name <> &quot;DateAmended&quot; Then
If FD.Name <> &quot;DateOnFile&quot; Then
SQL$ = &quot;UPDATE &quot; & TB.Name
'This is where you change the date...right now it's 15 days added
SQL$ = SQL$ & &quot; SET &quot; & FD.Name & &quot; = DateAdd('d', 15, &quot; & FD.Name & &quot;)&quot;
SQL$ = SQL$ & &quot;;&quot;
DB.Execute SQL$
End If
End If
End If
Next
End If
Next
DB.Close
End Sub

I'd like to do two things...I'd like to be able to run this off of the web, and I'd like to be able to input the number of days or months to advance it from the web page, probably from a form. I haven't seen anyone explaining how to access modules from the web, so I'm presuming I'll have to change this into a COM object...I don't know VBA or VB too well, certainly I'm more familiar with VBA.

ANy advice, starting points, or info would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top