bgreenhouse
Technical User
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 <> "CognosData" And TB.Name <> "CustomerCodedInformation" And TB.Name <> "Logins" And TB.Name <> "TimePeriod" And Left$(TB.Name, 4) <> "MSys" Then
For Each FD In TB.Fields
If FD.Type = dbDate Then
If FD.Name <> "DateAmended" Then
If FD.Name <> "DateOnFile" Then
SQL$ = "UPDATE " & TB.Name
'This is where you change the date...right now it's 15 days added
SQL$ = SQL$ & " SET " & FD.Name & " = DateAdd('d', 15, " & FD.Name & ""
SQL$ = SQL$ & ";"
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.
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 <> "CognosData" And TB.Name <> "CustomerCodedInformation" And TB.Name <> "Logins" And TB.Name <> "TimePeriod" And Left$(TB.Name, 4) <> "MSys" Then
For Each FD In TB.Fields
If FD.Type = dbDate Then
If FD.Name <> "DateAmended" Then
If FD.Name <> "DateOnFile" Then
SQL$ = "UPDATE " & TB.Name
'This is where you change the date...right now it's 15 days added
SQL$ = SQL$ & " SET " & FD.Name & " = DateAdd('d', 15, " & FD.Name & ""
SQL$ = SQL$ & ";"
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.