J
Jeff G
Now that I am running my access on 2002 instead of 2000 I am having a problem
getting some VB script to run. My programmer is out of the country for two
months so it's up to me. Here is the script that isn't running properly
below...
Sub CreateUserStatsRecords()
' assumes date is in fparam(4)
On Error Resume Next
Dim db As Database
Set db = DBEngine.Workspaces(0)(0)
Dim cs As Recordset
Dim sql As String
Dim TheDate As String
Dim date1 As String
date1 = Format$(fparam(4), "short date")
'thedate = "#" & date1 & "#"
TheDate = "#" & Left$(date1, Len(date1) - 2) & "20" & Right$(date1, 2) &
"#"
Dim crit As String
Dim us As Recordset
sql = "select * from [User Stats] where [Day] = " & TheDate
Set us = db.OpenRecordset(sql, DB_OPEN_DYNASET)
Set cs = db.OpenRecordset("Call Summary query 3", DB_OPEN_SNAPSHOT)
Do Until cs.EOF
DoEvents
crit = "[User Ptr] = " & Str$(cs![User Ptr])
us.FindFirst crit
If us.NoMatch Then
us.AddNew
us![User Ptr] = cs![User Ptr]
us![Day] = fparam(4)
us![Paid Hours] = cs![Default Hours]
us.Update
End If
cs.MoveNext
If Err Then Exit Do
Loop
cs.Close
us.Close
End Sub
If I run it on a Access 2000 machine, it runs properly. But if I run it on
Access 2002, I don't get anything.
I don't know much about this, so any help I can get would be greatly
appreciated. Thanks.
getting some VB script to run. My programmer is out of the country for two
months so it's up to me. Here is the script that isn't running properly
below...
Sub CreateUserStatsRecords()
' assumes date is in fparam(4)
On Error Resume Next
Dim db As Database
Set db = DBEngine.Workspaces(0)(0)
Dim cs As Recordset
Dim sql As String
Dim TheDate As String
Dim date1 As String
date1 = Format$(fparam(4), "short date")
'thedate = "#" & date1 & "#"
TheDate = "#" & Left$(date1, Len(date1) - 2) & "20" & Right$(date1, 2) &
"#"
Dim crit As String
Dim us As Recordset
sql = "select * from [User Stats] where [Day] = " & TheDate
Set us = db.OpenRecordset(sql, DB_OPEN_DYNASET)
Set cs = db.OpenRecordset("Call Summary query 3", DB_OPEN_SNAPSHOT)
Do Until cs.EOF
DoEvents
crit = "[User Ptr] = " & Str$(cs![User Ptr])
us.FindFirst crit
If us.NoMatch Then
us.AddNew
us![User Ptr] = cs![User Ptr]
us![Day] = fparam(4)
us![Paid Hours] = cs![Default Hours]
us.Update
End If
cs.MoveNext
If Err Then Exit Do
Loop
cs.Close
us.Close
End Sub
If I run it on a Access 2000 machine, it runs properly. But if I run it on
Access 2002, I don't get anything.
I don't know much about this, so any help I can get would be greatly
appreciated. Thanks.