zz error 2147352567 when trying to delete a record

D

davjoh123

I am receiving error 2147352567 when trying to delete a record from
form 1Cruise. The error is happening in a function that calculates and
sends a total weight to a text box. The delete never completes.

The code in the function is as follows and it errors when checking the
setid in the first if statement when attempting the delete but works
fine otherwise.

Public Function GetTotalWeight() As Double
On Error GoTo ErrHandler


Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCriteria As Long

'If Not IsNull([Forms]![Form1]![1Cruise].[Form]![CruiseID]) Then

If Not IsNull([Forms]![Form1]![1Cruise].[Form]![1Sets].[Form]!
[SetID]) Then
strSQL = "SELECT Sum([1CatchComposition].[Weight (kg)]) AS
[SumOfWeight (kg)], [1CatchComposition].SetIDFK " & _
"FROM 1CatchComposition " & _
"GROUP BY [1CatchComposition].SetIDFK " & _
"HAVING [1CatchComposition].SetIDFK=" & _
[Forms]![Form1]![1Cruise].[Form]![1Sets].[Form]!
[SetID] & ";"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

If Not rs.EOF Then
If Not IsNull(rs.Fields("[SumOfWeight (kg)]")) Then
GetTotalWeight = rs.Fields("[SumOfWeight (kg)]")
End If
Else
GetTotalWeight = 0
End If
End If
'End If

ErrHandler:
If Err.Number = 0 Then
Else
MsgBox Err.Number & " " & Err.Description & " " & "has
occurred in GetTotalWeight."
End If




End Function
 

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