Advertisement
Advertisement
| 07.15.2008 at 05:02AM PDT, ID: 23565729 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: |
'Created 14-Jul-08
'|About This Update....
'|Applicable Revision:
'|Min Revision Required: 20
'|
'|
'|
'|
'|
'_______________________________________________________________________
'COMPANY DATABASE FILE
Set db = OpenDatabase(global_db)
'VALIDATE FIELDS IN TABLE Departments
Set tbl = db.TableDefs("Departments")
'VERIFY FIELD: Table Departments Field CInvoice
needitem = True
For Each fld In tbl.Fields
If UCase(fld.Name) = UCase("CInvoice") Then
needitem = False
Exit For
End If
Next fld
If needitem = True Then
Set fld = tbl.CreateField("CInvoice", dbLong)
tbl.Fields.Append fld
fld.DefaultValue = 0
'UPDATE DATA
Set rsu = db.OpenRecordset("SELECT * from Departments")
While Not rsu.EOF = True
rsu.Edit
rsu!CInvoice = 0
rsu.Update
rsu.movenext
Wend
rsu.Close
End If
'VERIFY FIELD: Table Departments Field CWIP
needitem = True
For Each fld In tbl.Fields
If UCase(fld.Name) = UCase("CWIP") Then
needitem = False
Exit For
End If
Next fld
If needitem = True Then
Set fld = tbl.CreateField("CWIP", dbLong)
tbl.Fields.Append fld
fld.DefaultValue = 0
'UPDATE DATA
Set rsu = db.OpenRecordset("SELECT * from Departments")
While Not rsu.EOF = True
rsu.Edit
rsu!CWIP = 0
rsu.Update
rsu.movenext
Wend
rsu.Close
End If
'SEE IF TABLE DepartmentsBlocked EXIST
TableExists = False
For Each tbl In db.TableDefs
If UCase(tbl.Name) = UCase("DepartmentsBlocked") Then
TableExists = True
Exit For
End If
Next tbl
If TableExists = False Then
Set tbl = db.CreateTableDef("DepartmentsBlocked")
Set fld = tbl.CreateField("ID", dbLong)'Would like it indexed Dups NOT OK and Primary must be set to true
tbl.Fields.Append fld
fld.Attributes = dbAutoIncrField
db.TableDefs.Append tbl
End If
Set tbl = db.TableDefs("DepartmentsBlocked")
' VERIFY FIELD: Table DepartmentsBlocked Field MasterDep
needitem = True
For Each fld In tbl.Fields
If UCase(fld.Name) = UCase("MasterDep") Then
needitem = False
Exit For
End If
Next fld
If needitem = True Then
Set fld = tbl.CreateField("MasterDep", dbLong)'Would like it indexed Dups ok
tbl.Fields.Append fld
fld.DefaultValue = 0
'UPDATE DATA
Set rsu = db.OpenRecordset("SELECT * from DepartmentsBlocked")
While Not rsu.EOF = True
rsu.Edit
rsu!MasterDep = 0
rsu.Update
rsu.movenext
Wend
rsu.Close
End If
' VERIFY FIELD: Table DepartmentsBlocked Field NotAllowedDep
needitem = True
For Each fld In tbl.Fields
If UCase(fld.Name) = UCase("NotAllowedDep") Then
needitem = False
Exit For
End If
Next fld
If needitem = True Then
Set fld = tbl.CreateField("NotAllowedDep", dbLong) 'Would like it indexed Dups ok
tbl.Fields.Append fld
fld.DefaultValue = 0
'UPDATE DATA
Set rsu = db.OpenRecordset("SELECT * from DepartmentsBlocked")
While Not rsu.EOF = True
rsu.Edit
rsu!NotAllowedDep = 0
rsu.Update
rsu.movenext
Wend
rsu.Close
End If
End Sub
|