Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Runtime error 2465 - Application defined or object defined error.

Posted on 2004-04-21
6
Medium Priority
?
1,291 Views
Last Modified: 2010-08-05
When I create a customised rates for customer Fred, and delete one of the rates
Eg Hanoi, Vietnam Parcel
Then come to select that same rate. It brings up an application error. Saying
Runtime error 2465 - Application defined or object defined error.

The debug points too the line in the formcode that says..
MsgBox "No rates for Customer " & Me.Form.CName & ", Rates must be created in Customer Form"

In other words, it doesn’t show the message above as expected. Any clues?
thanks

0
Comment
Question by:elusivesoul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 10878081
Are you working on an mde or mdb?
If it is an mdb can you post the codes for selection of rate, or better all the codes related to this problem.
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 400 total points
ID: 10878132
1. Does CName exist as a control on the form?
2. Why do Me.Form.CName, if and when CName is on the same form as what you are using, you can just do Me.Cname

(if you do Me. then CName should come up, if not then Cname does not exist, hence error)


0
 

Author Comment

by:elusivesoul
ID: 10878672
its an mdb file,,,,


Private Sub NewCalc()
lngIncrements = 0
fWeightDifference = 0
fShipRate = 0

strSQL = "SELECT * FROM tblCustomersRates_PubRates_Trans WHERE CRPR_IDSillyCust = " & Forms!frmCustomers!CustID & _
              " AND CRPR_IDZoneRate = '" & Me.txtZone & _
              "' AND PkgType = '" & Me.txtPkgType & _
              "' And Active = -1" & _
              " ORDER BY Weight1 DESC;"
Set DB = DBEngine(0)(0)
Set rs = DB.OpenRecordset(strSQL)

If rs.EOF And rs.BOF Then ' we have NO records
    MsgBox "No rates for Customer " & Me.Form.CName & ", Rates must be created in Customer Form"
    GoTo Exit_cmdCalculate_Click
Else
    rs.MoveLast
    iRecCount = rs.RecordCount
    rs.MoveFirst
End If

Do Until rs.EOF
    Me.txtWt1 = rs!Weight1
    Me.txtRate1 = rs!Rate1
    Me.txtWt2 = rs!Weight2
    Me.txtRate2 = rs!Rate2
    Me.txtSurcharge = rs!Surcharge
    fWeightDifference = Weight - Me.txtWt1

    If Weight >= rs!Weight1 Then
        If Weight > rs!Weight1 Then
            lngIncrements = 1
            fShipRate = rs!Rate1 + rs!Rate2 + rs!Surcharge
                Do Until fWeightDifference <= rs!Weight2
                    lngIncrements = lngIncrements + 1
                    fWeightDifference = fWeightDifference - rs!Weight2
                    fShipRate = fShipRate + rs!Rate2
                Loop
                fExtraCharge = lngIncrements * rs!Rate2
            Me.txtExtra = Format(rs!Rate2, "$0.00") & " x " & lngIncrements & " = " & Format(rs!Rate2 * lngIncrements, "$0.00")
            Exit Do
        Else
            fShipRate = rs!Rate1 + rs!Surcharge
            Exit Do
       End If
    Else
        fShipRate = rs!Rate1 + rs!Surcharge
        'Me.txtExtra = 0
    End If
    rs.MoveNext
Loop

    Me.txtSubTot = fShipRate

If Me.txtDiscount <> 0 Then
    fShipRate = fShipRate - (fShipRate * txtDiscount)
End If
    Me.txtDiscount = [Forms]![frmCustomers]!Discount
    Me.txtWt1.Requery
    Me.txtRate1.Requery
    Me.txtWt2.Requery
    Me.txtRate2.Requery
    Me.txtExtra.Requery
    Me.txtSubTot.Requery
    Me.txtSurcharge.Requery
    Me.txtDiscount.Requery

Me.txtTotalCost = fShipRate

Err_cmdCalculate_Click:
    If Err.Number = 20 Or Err.Number = 0 Then
    Exit Sub
    Else
    MsgBox "Can't find rate.  This rate does not exist in the Customized Rates table.", vbInformation + vbOKOnly, "Add Rate"
    End If
    Resume Exit_cmdCalculate_Click
   
Exit_cmdCalculate_Click:
    Exit Sub

End Sub
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 10878804
  MsgBox "No rates for Customer " & Me.Form.CName & ", Rates must be created in Customer Form"
-------------------------------------------^^^^^^^^^^^ change to Me.CName

Is Cname a control on your form?  as rockiroads have pointed out.
0
 
LVL 11

Accepted Solution

by:
Mighty_Silly earned 1600 total points
ID: 10885205
ES,

If the code is in the subform, and the field referred to in you code is on the Main form, then you need to refer to it in correct syntax...

Me.MainForm.Cname

That should work.

-Silly-

:')-
0
 

Author Comment

by:elusivesoul
ID: 10885579
Yep, you were right silly, it was actually on a subform. Thanks for that. Much appreciated guys.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question