Sub RecordMove (fName$, Path$, DestDir$, uName$)
Dim DB As Database, DS As DynaSet, 
[[lcc]] T1 As Table, T2 As Table
Dim sPath%,dPath%
sPath%= GetQueueNum%(Path$)
dPath%= GetQueueNum%(DestDir$)

' Open database and tables
Set DB = OpenDatabase(MyDatabase$)
Set T1 = DB.OpenTable("Files")
Set T2 = DB.OpenTable("Moves")

' Locate fName$ in Files table
T1.Index = "idxFiles"
T1.Seek "=", fName$
T1.LockEdits = False

' Add a new record to Files if Seek fails
BeginTrans
If T1.NoMatch Then   'if file not already in db, then
   T1.AddNew
Else
   T1.Edit
End If

' Always add a new record to Moves
T2.AddNew

' Record move data in Files table
T1("FileName") = fName$
T1("mFrom") = sPath%
T1("mTo") = dPath%
T1("Date") = Date$
T1("Time") = Time$
T1("mBy") = uName$
T1("Path") = dPath%


' Record move data in Moves table
T2("FileName") = fName$
T2("mTo") = dPath%
T2("mFrom") = sPath%
T2("MovedBy") = uName$)
T2("mDate") = Date$
T2("mTime") = Time$

' Finish up
T1.Update
T2.Update
CommitTrans
T1.Close
T2.Close
DB.Close
End Sub
