santastefano
Programmer
I have an application that functions as an access (2000) file on any computer.
When compiled as an .mdb file it continues to function on the machine that created the file but crashes on another machine with the message “Execution of this application has stopped due to a run time error”
Both computers have the same references checked.
Visual Basic for applications
Microsoft Access 10 Object library
OLE Automation
Microsoft ActiveX Data Objects 2.1 library
Microsoft DAO object library
Here is an extract of the code that crashes
I have found that the problem can be fixed by changing the forms so that they save directly to the table but WORRIED that I can not understand the cause of the problem.
When compiled as an .mdb file it continues to function on the machine that created the file but crashes on another machine with the message “Execution of this application has stopped due to a run time error”
Both computers have the same references checked.
Visual Basic for applications
Microsoft Access 10 Object library
OLE Automation
Microsoft ActiveX Data Objects 2.1 library
Microsoft DAO object library
Here is an extract of the code that crashes
Code:
Dim varCode As String
Dim varCompanyName As Variant
Dim varOrderNumber As Variant
Dim varTeacher As String
Dim varLanguage As String
Dim varPurpose As Variant
Dim varBook As String
Dim varTotalSessions As Integer
Dim varSessionsWeek As Integer
Dim varNumberStudents As Integer
Dim varTuition As Currency
Dim varPrivate As CheckBox
Dim varCompany As CheckBox
Dim varIn As CheckBox
Dim varOut As CheckBox
Dim rsCourses As DAO.Recordset
If Me.Tuition = 0 Or IsNull(Me.Tuition) Then
DoCmd.CancelEvent
Reply = MsgBox("Please enter a course cost or select cancel to quit without saving the record", 65, "School Run")
If Reply = 2 Then
DoCmd.CancelEvent
DoCmd.GoToControl "Cancel"
Else
DoCmd.GoToControl "Tuition"
End If
ElseIf Me.In.Value = Me.Out.Value Then
DoCmd.CancelEvent
Reply = MsgBox("Please select In or Out of school for location or select cancel to quit without saving the record", 65, "School Run")
If Reply = 2 Then
DoCmd.CancelEvent
DoCmd.GoToControl "Cancel"
Else
Me.In = False
Me.Out = False
DoCmd.GoToControl "In"
End If
Else
If Forms!frmCourseBegin!Private = True Then
Set db = CurrentDb
Set rsCourses = db.OpenRecordset("tblcourses", dbopendynaset)
varCode = Forms!frmCourseStart1!Code
varTeacher = Forms!frmCourseStart1!TeacherLastName
varLanguage = Forms!frmCourseStart1!Language
varTotalSessions = Forms!frmCourseStart1!TotalSessions
varSessionsWeek = Forms!frmCourseStart1!SessionsWeek
varNumberStudents = Forms!frmCourseStart1!NumberStudents
varTuition = Forms!frmCourseMisc!Tuition
varPurpose = Forms!frmCourseMisc!Combo11
varBook = Forms!frmCourseMisc!Book
Set varPrivate = Forms!frmCourseStart1!Private
Set varCompany = Forms!frmCourseStart1!Company
Set varIn = Forms!frmCourseMisc!In
Set varOut = Forms!frmCourseMisc!Out
With rsCourses
.AddNew 'Creates new record in the table
!Code = varCode
!TeacherLastName = varTeacher
!Language = varLanguage
!Purpose = varPurpose
!Book = varBook
!TotalSessions = varTotalSessions
!SessionsWeek = varSessionsWeek
!NumberStudents = varNumberStudents
!Tuition = varTuition
!Private = varPrivate
!Company = varCompany
!In = varIn
!Out = varOut
.Update 'Confirms the record to the table.
End With
rsCourses.Close 'Closes the table
Set rsCourse = Nothing 'Sets the rsTimeTable Object to nothing.
Set db = Nothing