Question : Run-Time Error 13 - VBA

I have a program that is supposed to accept a serial number, and based on the first character of that serial number query a table that contains weight values based on that first character and return that value into a text box.  The event is triggered by an option button that the user checks 'yes' or 'no' based on whether or not the part has a cover.  If 'no' then the value is 0.  If yes then the event proceeds as stated above.  The run-time error seems to be occurring when i run the sql string (see notation below).  It was working at one point, but somewhere along the line something changed and now it does not want to work.  Any help would be appreciated.  Thank you.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
Private Sub frmCover_AfterUpdate()
Dim strBatType As String
Dim strsql As String
Dim objRS As Recordset
Dim strCW As String
Me.SN.SetFocus
If Me.SN.Text = "" Then
    MsgBox ("Enter A Serial Number")
    Exit Sub
End If
 
Me.CoverWeight.SetFocus
    
If Me.frmCover.Value = 1 Then
    Me.CoverWeight.Value = 0
Else
    strBatType = Left(Me.SN.Value, 1)
    'NEED TO VALIDATE THE BATTERY TYPE VALUE ASSGINED ABOVE.
    'TODO: THE VALIDATION SHOULD ALSO BE DONE WHEN THE SERIAL NUMBER IS FIRST ENTERED INTO THE FORM.
    
    'QUERY THE TABLE FOR COVER WEIGHTS
    strsql = "SELECT CoverWeight FROM CoverWeights WHERE BatteryType = '" & strBatType & "'"
    Set objRS = CurrentDb.OpenRecordset(strsql)  (This is where the problem is)
    If Not objRS.EOF Then
        'EXTRACT THE COVERWEIGHT
        strCW = objRS.Fields("CoverWeight").Value
        Me.CoverWeight.Value = strCW
        
    Else
        'RETURN MSG BOX INDICATING THE COVERWEIGHT WAS NOT FOUND.
        MsgBox ("Cover Weight Does Not Exist")
        Exit Sub
    End If
    
End If
Me.NetWeight.SetFocus
Me.NetWeight.Value = Me.GrossWeight.Value - Me.CoverWeight.Value
Me.WeightLoss.SetFocus
Me.WeightLoss.Value = Me.PostWeight.Value - Me.NetWeight.Value
If Me.PostWeight.Value <> 0 Then
Me.PercentWeightLoss.SetFocus
Me.PercentWeightLoss.Value = Me.WeightLoss.Value / Me.PostWeight.Value
Else
Me.PercentWeightLoss.SetFocus
Me.PercentWeightLoss.Value = 0
End If
Me.Damage.SetFocus
End Sub

Answer : Run-Time Error 13 - VBA

Declare as a DAO recordset specifically:

Dim objRS As DAO.Recordset
Random Solutions  
 
programming4us programming4us