Microsoft Access has encountered a problem

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I get the following message every time I execute the below Code.

Can anyone suggest how I may find out what is causing this error?

Microsoft Access has encountered a problem and needs to close. We are sorry
for the inconvenience.

Error Signature:
AppName: msaccess.exe
AppVer: 10.0.6501.0
ModName: msjtes40.dll
ModVer: 4.0.9025.0
Offset: 0000872a

My Code
Private Sub cmdUpdateDisc_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset

If Me.Dirty Then
Me.Dirty = False
End If

Set db = CurrentDb()
Set rs = Forms![frmQuotes]![sfrmOrdersSubform].Form.RecordsetClone

If Me.COMPANY = "C1" Then
Set rs1 = db.OpenRecordset("qryICStockPrice_C1")
ElseIf Me.COMPANY = "C2" Then
Set rs1 = db.OpenRecordset("qryICStockPrice_C2")
End If

If rs.RecordCount > 0 And rs1.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
rs1.FindFirst "Item = """ & rs!Item & """"
If Not rs1.NoMatch Then
rs.Edit
rs![ListPrice] = Nz(rs1![ListPrice], 0)
rs![AvgCost] = Nz(rs1![AVG_COST], 0)
rs![AR_CODE] = Nz(rs1![AR_CODE], "")
rs![AR_Matrix] = Me.AR_Matrix
rs![Whse] = Me.Whse
rs![COMPANY] = Me.COMPANY
rs.Update
End If
rs.MoveNext
Loop
End If
rs1.Close

Set rs = Nothing
Set rs1 = Nothing
Set db = Nothing

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblOrderDetails LEFT JOIN tblDiscMatrix " & _
"ON (tblOrderDetails.AR_Matrix = tblDiscMatrix.AR_Matrix) " & _
"AND (tblOrderDetails.AR_Code = tblDiscMatrix.AR_Code) " & _
"SET tblOrderDetails.Multiply = [tblDiscMatrix].[Discount] " & _
"WHERE tblOrderDetails.QuoteID =" & quoteID
DoCmd.SetWarnings True

Me.Refresh


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top