Link to home
Start Free TrialLog in
Avatar of PenningtonCounty
PenningtonCountyFlag for United States of America

asked on

Issue with mfc80u.dll


When a user is running one of my applications they get an error box from windows stating:

Faulting application miscreceiptssystem.exe, version 1.9.0.60, stamp 4dcac09b, faulting module mfc80u.dll, version 8.0.50727.762, stamp 45713438, debug? 0, fault address 0x00056eeb.

It then asks if the user wants to send an error error report to Microsoft.

This application is used on several computers, and only one computer is running into this problem.

The application was built using Visual Studio 2008 (VB specifically), and the install was created using the Publish method(Click once, I think is another name for the install method).

The error itself occurs when a crystal report is attempting to print.
Avatar of Mike McCracken
Mike McCracken

Any differences between the machines that work and the machine that doesn't?
Windows version?  SP level?
Other software?
Printers available?

What version of Crystal?

mlmcc
Avatar of PenningtonCounty

ASKER

no differences that i am aware of.  Crystal Reports 2008
Are you using the MicroSoft Foundation Classes in the report or the application?

mlmcc
not that I am aware of.
That is what that dll is for.

mlmcc

Report1 and Report2 are variables that are of assigned to specific Crystal Reports.

As far as I've been able to determine the error is happening somwhere in this part of the code.

report1 = Nothing
report2 = Nothing

If currentUser.defaultDeptID = Convert.ToInt32(DepartmentCodes.Treasurer) Then
	report2 = New CustomerReceipt
	ConfigureCrystalReports2(receiptID)

	'Determine if one or two copies of the receipt have been requested
	If chkPrintDuplicateCopies.Checked Then
		'This prints two copies of all pages to the default printer, and collates them
		report2.PrintOptions.PrinterName = currentUser.Printer
		report2.PrintToPrinter(2, True, 0, 0)
	Else
		'This prints one copy of all pages to the default printer, and collates them
		report2.PrintOptions.PrinterName = currentUser.Printer
		report2.PrintToPrinter(1, True, 0, 0)
	End If

	report2.Close()

Else
	report1 = New ReceiptForm
	ConfigureCrystalReports1(receiptID)

	'Determine if one or two copies of the receipt have been requested
	If chkPrintDuplicateCopies.Checked Then
		'This prints two copies of all pages to the default printer, and collates them
		report1.PrintOptions.PrinterName = currentUser.Printer
		report1.PrintToPrinter(2, True, 0, 0)
	Else
		'This prints one copy of all pages to the default printer, and collates them
		report1.PrintOptions.PrinterName = currentUser.Printer
		report1.PrintToPrinter(1, True, 0, 0)
	End If

	report1.Close()

End If

Open in new window

WHat do the ConfigureCrystalReports1 and ConfigureCrystalReports2 processes do?

mlmcc
Sorry about that.  Here is the code for them


Private Sub ConfigureCrystalReports1(ByVal rcptID As Int64)

	'Set report data source to proper sql server for data extraction
	If My.Settings.MiscReceiptsSystemConnectionString.ToUpper.Contains("ITS-SQL08-VM") Then
		report1.DataSourceConnections(0).SetConnection("ITS-SQL08-VM", "MiscReceiptsSystem", True)
	Else
		report1.DataSourceConnections(0).SetConnection("ITS-TESTSQL8-VM", "MiscReceiptsSystem", True)
	End If

	crParameterFieldDefinitions1 = report1.DataDefinition.ParameterFields

	crParameterFieldLocation1 = crParameterFieldDefinitions1.Item("DesiredRecordID")
	crParameterValues = crParameterFieldLocation1.CurrentValues
	crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
	crParameterDiscreteValue.Value = rcptID
	crParameterValues.Add(crParameterDiscreteValue)
	crParameterFieldLocation1.ApplyCurrentValues(crParameterValues)

	crParameterFieldLocation1 = crParameterFieldDefinitions1.Item("DepartmentName")
	crParameterValues = crParameterFieldLocation1.CurrentValues
	crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
	crParameterDiscreteValue.Value = GetDepartment(GetDepartmentIDOnReceipt(rcptID))
	crParameterValues.Add(crParameterDiscreteValue)
	crParameterFieldLocation1.ApplyCurrentValues(crParameterValues)

End Sub


Private Sub ConfigureCrystalReports2(ByVal rcptID As Int64)
	'Declaration of local variables
	Dim receivedByID As Integer = 0

        If lblSelectedReceiptID.Text <> "0" Then
            receivedByID = dtMasterReceiptTable.Select("id=" + rcptID.ToString())(0)("CreatedBy")
        End If

            'Set report data source to proper sql server for data extraction
            If My.Settings.MiscReceiptsSystemConnectionString.ToUpper.Contains("ITS-SQL08-VM") Then
                report2.DataSourceConnections(0).SetConnection("ITS-SQL08-VM", "MiscReceiptsSystem", True)
            Else
                report2.DataSourceConnections(0).SetConnection("ITS-TESTSQL8-VM", "MiscReceiptsSystem", True)
            End If

            crParameterFieldDefinitions2 = report2.DataDefinition.ParameterFields

            crParameterFieldLocation2 = crParameterFieldDefinitions2.Item("DesiredRecordID")
            crParameterValues = crParameterFieldLocation2.CurrentValues
            crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue

            If lblSelectedReceiptID.Text = "0" Then
                crParameterDiscreteValue.Value = rcptID
            Else
                crParameterDiscreteValue.Value = rcptID
            End If

            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldLocation2.ApplyCurrentValues(crParameterValues)

            crParameterFieldLocation2 = crParameterFieldDefinitions2.Item("ReceivedBy")
            crParameterValues = crParameterFieldLocation2.CurrentValues
            crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
            If lblSelectedReceiptID.Text = "0" Then
                crParameterDiscreteValue.Value = dtMasterReceiptTable.Select("id=" + rcptID.ToString())(0)("CreatedByName")
            Else
                crParameterDiscreteValue.Value = dtMasterReceiptTable.Select("id=" + rcptID.ToString())(0)("CreatedByName") 'GetUserName(receivedByID)
            End If
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldLocation2.ApplyCurrentValues(crParameterValues)

            If tabMain.SelectedIndex() = 0 Then
                'Add Receipt tab active
                crParameterFieldLocation2 = crParameterFieldDefinitions2.Item("SelectedTab")
                crParameterValues = crParameterFieldLocation2.CurrentValues
                crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
                crParameterDiscreteValue.Value = "Add"
                crParameterValues.Add(crParameterDiscreteValue)
                crParameterFieldLocation2.ApplyCurrentValues(crParameterValues)
            Else
                'View Receipt tab active
                crParameterFieldLocation2 = crParameterFieldDefinitions2.Item("SelectedTab")
                crParameterValues = crParameterFieldLocation2.CurrentValues
                crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
                crParameterDiscreteValue.Value = "View"
                crParameterValues.Add(crParameterDiscreteValue)
                crParameterFieldLocation2.ApplyCurrentValues(crParameterValues)
            End If

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The logging example given from the given link resolved the issue.  Not sure how adding a logging method used to find what was causing the error, instead emlinated the error, but it did.