Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with code when using Win2000

Status
Not open for further replies.

TnE

Technical User
Feb 18, 2003
9
0
0
DE
I wrote the following code that worked well with all the Windows OS for the exception of Windows 2000. Everything works except that it won't run the PowerPoint presentation. Can anyone assist?

Private Function OpenLesson() As Integer
Dim hInstance As Long
Dim hProcess As Long
Dim lngRetval As Long
Dim lngExitCode As Long
Dim vTopicName As String
Dim sDataDrive As String
Dim RetVal
Dim strCommand As String
Dim intMode As Integer
Dim vSSAN As Variant
Dim rst As Recordset
Dim db As Database
Dim Topic As Integer
Dim TopicName As String
Dim iFileExists As Integer
Dim vFile As String
On Error Resume Next
vSSAN = Forms!frmPeopleUser.SSAN
Topic = Forms!frmCBT.topicview
TopicName = DLookup("[TopicName]", "CBTTopics", "[TopicID]= Forms!frmCBT!topicview")

If MsgBox("You have selected " & TopicName & " lesson to review/test" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Are you sure you want to continue?", vbYesNo, "REVIEW/TEST ON " & TopicName & "?") = vbYes Then
Set db = DBEngine.Workspaces(0).OpenDatabase(DataMDB())
Set rst = db.OpenRecordset("Results")
rst.Index = "PrimaryKey"
rst.Seek "=", vSSAN, Topic

If rst.NoMatch Then
OpenForm:
intMode = 1
sDataDrive = Left$(Backend(), 1)
strCommand = "C:\Program Files\Microsoft Office\Office\powerpnt.exe/s" & "C:\Asims\Win\SGPR\CBT\" & TopicName & ".pps"
vFile = "C:\Asims\Win\SGPR\CBT\" & TopicName & ".pps"
iFileExists = utFileExists(vFile)
If iFileExists = -1 Then
MsgBox "You are about to view a Powerpoint Show." & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Use your Page Down key to move forward to next slide." & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Use the Page Up key to move back to a previous slide.", vbInformation, "POWERPOINT SHOW VIEWING GUIDE"
Dim pr As PowerPoint.Presentation
Set pr = GetObject(vFile)
pr.SlideShowSettings.Run
DoCmd.OpenForm "frmCBTtest", acNormal
Else
MsgBox "This lesson is not ready yet", vbInformation, "TRY AGAIN LATTER"
End If
Else
If Date - rst![DateTaken] < 365 Then
If MsgBox(&quot;You completed this lesson &quot; & Date - rst![DateTaken] & &quot; days ago and scored &quot; & rst![Score] * 100 & &quot;%.&quot; & Chr(13) & Chr(10) & Chr(13) & Chr(10) & &quot;Do you still want to take this lesson?&quot;, vbYesNo, &quot;YOU ARE CURRENT ON THIS LESSON&quot;) = vbYes Then
rst.Edit
rst.Delete
GoTo OpenForm
End If
Else
rst.Edit
rst.Delete
GoTo OpenForm
rst.Close
db.Close
End If
End If
End If
End Function
 
You should start by taking out (or REM) the On Error Resume Next statement to see where it's failing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top