cyberbiker
Programmer
I am working on converting an app that used ACCESS 97 tables and the jet database engine to use SQL Server 7 tables, MSDE and ADO.
I seem to follow most of what I need, but do not fully understand the code written by previous programmers.
There are numerous cases in the existing code where QueryDef and tabledef were used for no logical reason that I can see. Mostly, where Querydef and tabledef were used, I can handle pretty easily by using SQL Create Table, Alter Table etc.
But the following is an example of code that I do not know how to fix.
The function returns a value indicating the time difference between the last update and the current time using DateDiff.
How do I handle this without using TableDef?
I really should also ask whether I use tabledef with SQL Server and ADO? I would prefer to use another way if possible.
Function pfRackListRecent() As Integer
' Checks if the current rack list was recently generated
Dim db As Database, td As TableDef, sec As Variant
On Error Resume Next
Set db = DBEngine(0)(0)
db.TableDefs.Refresh
Set td = db.TableDefs(pcRACKLISTNAME)
sec = DateDiff("s", td.LastUpdated, Now)
pfRackListRecent = (ERR = 0 And sec < 120)
End Function
Thanks for reading this Terry (cyberbiker)
I seem to follow most of what I need, but do not fully understand the code written by previous programmers.
There are numerous cases in the existing code where QueryDef and tabledef were used for no logical reason that I can see. Mostly, where Querydef and tabledef were used, I can handle pretty easily by using SQL Create Table, Alter Table etc.
But the following is an example of code that I do not know how to fix.
The function returns a value indicating the time difference between the last update and the current time using DateDiff.
How do I handle this without using TableDef?
I really should also ask whether I use tabledef with SQL Server and ADO? I would prefer to use another way if possible.
Function pfRackListRecent() As Integer
' Checks if the current rack list was recently generated
Dim db As Database, td As TableDef, sec As Variant
On Error Resume Next
Set db = DBEngine(0)(0)
db.TableDefs.Refresh
Set td = db.TableDefs(pcRACKLISTNAME)
sec = DateDiff("s", td.LastUpdated, Now)
pfRackListRecent = (ERR = 0 And sec < 120)
End Function
Thanks for reading this Terry (cyberbiker)