locked
Error 424 - Object Required RRS feed

  • Question

  • I have a similar issue to one stated previously, however my problem is with 2 identical "accdb" files.

    I have some code modified in a file that resides on 2 different machines, one is a Win10 running Access 2016,
    the other is a Win7 VM running Access 2007.

    I have modified code, table structure and buttons on both these test environments, duplicating exactly the
    same steps from one to the other.

    Everything works find on all test environments.

    When I go to make the same changes in production on a Win7, Access 2007 machine my button code fails.

    I am trying to set a payment method field to reflect payment type for reporting as either "CC", "Cash", "Check".

    The table field is set as text.

    Button code is:

             Private Sub btnCC_Click()

                PmtType.Value = "CC"

             End Sub

    I've already tried the Me. and Me! fixes noted elsewhere and that does not work either.

    All library references are identical throughout all machines.

    I'm sure i'm missing something very simple, but i've been stuck now for 3 days.

    Thanks for the help.

    Tuesday, February 27, 2018 8:25 PM

All replies

  • Hi David,

    My first suggestion is to make sure the name of the control (textbox) is different than the name of the field to which it is bound. For example, if the name of the field is PmtType, then change the name of the textbox to txtPmtType. Then in your code, use the name of the textbox. For example:

    Me.txtPmtType = "CC"

    Hope it helps...

    Tuesday, February 27, 2018 8:37 PM
  • There is no textbox.. the assignment is made directly from the PmtType value to the DB value in the dynaset and
    saved to the database.

    Tuesday, February 27, 2018 9:24 PM
  • Hi,

    If you're using code, can you please post the entire code for review? Thanks.

    In the code you posted, originally, I don't see any dynaset (recordset?) object.

    Tuesday, February 27, 2018 9:40 PM
  • The entire codebase is several hundred lines long, and I'm working on someone else's basline code
    that may be a bit cumbersome and I apologize in advance if this gets too lengthy, but I'll post the all the
    code I'm dealing with in the "invoice" form.

    I'm sure some of this could be done more efficiently, but right now my client doesn't want major changes,just a few added features, and I'm just stumped why it works on all my environments, but not the customers.

    I've added a few commented lines of where I added my statements for PmtType.

    Thanks again to all for your help.

    Option Compare Database


    Private Sub btCash_Click()

    PmtType.Value = "Cash"

    End Sub

    Private Sub btnCC_Click()

    PmtType.Value = "CC"

    End Sub

    Private Sub btnCheck_Click()

    PmtType.Value = "Check"

    End Sub

    Private Sub cmdCalc_Click()
    Dim partssubtotal As Currency
    Dim laborsubtotal As Currency

    partssubtotal = 0
    laborsubtotal = 0

    If Not IsNull(Me!Part1Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part1Cost.Value
    End If
    If Not IsNull(Me!Part2Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part2Cost.Value
    End If
    If Not IsNull(Me!Part3Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part3Cost.Value
    End If
    If Not IsNull(Me!Part4Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part4Cost.Value
    End If
    If Not IsNull(Me!Part5Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part5Cost.Value
    End If
    If Not IsNull(Me!Part6Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part6Cost.Value
    End If
    If Not IsNull(Me!Part7Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part7Cost.Value
    End If
    If Not IsNull(Me!Part8Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part8Cost.Value
    End If
    If Not IsNull(Me!Part9Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part9Cost.Value
    End If
    If Not IsNull(Me!Part10Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part10Cost.Value
    End If
    If Not IsNull(Me!part11cost.Value) Then
    partssubtotal = partssubtotal + Me!part11cost.Value
    End If
    If Not IsNull(Me!part12cost.Value) Then
    partssubtotal = partssubtotal + Me!part12cost.Value
    End If
    If Not IsNull(Me!part13cost.Value) Then
    partssubtotal = partssubtotal + Me!part13cost.Value
    End If
    If Not IsNull(Me!part14cost.Value) Then
    partssubtotal = partssubtotal + Me!part14cost.Value
    End If
    If Not IsNull(Me!part15cost.Value) Then
    partssubtotal = partssubtotal + Me!part15cost.Value
    End If
    If Not IsNull(Me!part16cost.Value) Then
    partssubtotal = partssubtotal + Me!part16cost.Value
    End If
    If Not IsNull(Me!part17cost.Value) Then
    partssubtotal = partssubtotal + Me!part17cost.Value
    End If
    If Not IsNull(Me!part18cost.Value) Then
    partssubtotal = partssubtotal + Me!part18cost.Value
    End If
    If Not IsNull(Me!part19cost.Value) Then
    partssubtotal = partssubtotal + Me!part19cost.Value
    End If
    If Not IsNull(Me!part20cost.Value) Then
    partssubtotal = partssubtotal + Me!part20cost.Value
    End If



    If Not IsNull(Me!Labor1Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor1Cost.Value
    End If
    If Not IsNull(Me!Labor2Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor2Cost.Value
    End If
    If Not IsNull(Me!Labor3Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor3Cost.Value
    End If
    If Not IsNull(Me!Labor4Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor4Cost.Value
    End If
    If Not IsNull(Me!Labor5Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor5Cost.Value
    End If
    If Not IsNull(Me!Labor6Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor6Cost.Value
    End If
    If Not IsNull(Me!Labor7Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor7Cost.Value
    End If
    If Not IsNull(Me!Labor8Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor8Cost.Value
    End If
    If Not IsNull(Me!Labor9Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor9Cost.Value
    End If
    If Not IsNull(Me!Labor10Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor10Cost.Value
    End If
    If Not IsNull(Me!Labor11Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor11Cost.Value
    End If
    If Not IsNull(Me!Labor12Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor12Cost.Value
    End If
    If Not IsNull(Me!Labor13Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor13Cost.Value
    End If
    If Not IsNull(Me!Labor14Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor14Cost.Value
    End If
    If Not IsNull(Me!Labor15Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor15Cost.Value
    End If
    If Not IsNull(Me!Labor16Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor16Cost.Value
    End If
    If Not IsNull(Me!Labor17Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor17Cost.Value
    End If
    If Not IsNull(Me!Labor18Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor18Cost.Value
    End If
    If Not IsNull(Me!Labor19Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor19Cost.Value
    End If
    If Not IsNull(Me!Labor20Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor20Cost.Value
    End If


    Me!ComParts.Value = partssubtotal * 100
    Me!ComLabor.Value = laborsubtotal * 100
    Me!ComSublet.Value = Me!Sublet.Value * 100
    Me!ComSupplies.Value = Me!Supplies.Value * 100

    Me!partssubtotal.Value = partssubtotal
    Me!TotalParts.Value = partssubtotal
    Me!laborsubtotal.Value = laborsubtotal
    Me!TotalLabor.Value = laborsubtotal
    Me!Tax.Value = (Me!TotalParts.Value - Me!AshCost.Value) * 0#
    Me!Total.Value = Me!partssubtotal.Value + Me!laborsubtotal.Value + Me!Supplies.Value + Me!Tax.Value + Me!Sublet.Value
    Me!AmountDue.Value = Me!Total.Value - Me!amountpaid.Value
    Me!Tax.Value = (Me!TotalParts.Value - Me!AshCost.Value) * 0#
    Me!Total.Value = Me!partssubtotal.Value + Me!laborsubtotal.Value + Me!Supplies.Value + Me!Tax.Value + Me!Sublet.Value

    End Sub

    Private Sub cmdPrint2_Click()

    On Error GoTo Err_cmdPrint2_Click
    Me!FirstName.SetFocus
    Me!cmdPrint.Visible = False
    Me!cmdPrint2.Visible = False
    Me!cmdCalc.Visible = False
    Me!cmdClose.Visible = False
    Me!cmdSave.Visible = False
    Me!cmdUpdate.Visible = False
    Me!AshCost.Visible = False
    Me!LabelAshCost.Visible = False

        
        DoCmd.PrintOut acPages, 1, 1, acMedium, 2, True
            
    If isPreviousOrder = 0 Then
            Me!cmdPrint.Visible = True
            Me!cmdPrint2.Visible = True
            Me!cmdCalc.Visible = True
            Me!cmdClose.Visible = True
            Me!cmdSave.Visible = True
            Me!cmdUpdate.Visible = False
    Else:   Me!cmdPrint.Visible = True
            Me!cmdPrint2.Visible = True
            Me!cmdCalc.Visible = True
            Me!cmdClose.Visible = True
            Me!cmdSave.Visible = False
            Me!cmdUpdate.Visible = True
            Me!cmdCalc.Enabled = True
    End If

    Exit_cmdPrint2_Click:
        Exit Sub

    Err_cmdPrint2_Click:
        MsgBox Err.Description
        Resume Exit_cmdPrint2_Click
    End Sub

    Private Sub cmdSave_Click()
    Dim partssubtotal As Currency
    Dim laborsubtotal As Currency

    partssubtotal = 0
    laborsubtotal = 0

    If Not IsNull(Me!Part1Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part1Cost.Value
    End If
    If Not IsNull(Me!Part2Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part2Cost.Value
    End If
    If Not IsNull(Me!Part3Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part3Cost.Value
    End If
    If Not IsNull(Me!Part4Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part4Cost.Value
    End If
    If Not IsNull(Me!Part5Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part5Cost.Value
    End If
    If Not IsNull(Me!Part6Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part6Cost.Value
    End If
    If Not IsNull(Me!Part7Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part7Cost.Value
    End If
    If Not IsNull(Me!Part8Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part8Cost.Value
    End If
    If Not IsNull(Me!Part9Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part9Cost.Value
    End If
    If Not IsNull(Me!Part10Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part10Cost.Value
    End If
    If Not IsNull(Me!part11cost.Value) Then
    partssubtotal = partssubtotal + Me!part11cost.Value
    End If
    If Not IsNull(Me!part12cost.Value) Then
    partssubtotal = partssubtotal + Me!part12cost.Value
    End If
    If Not IsNull(Me!part13cost.Value) Then
    partssubtotal = partssubtotal + Me!part13cost.Value
    End If
    If Not IsNull(Me!part14cost.Value) Then
    partssubtotal = partssubtotal + Me!part14cost.Value
    End If
    If Not IsNull(Me!part15cost.Value) Then
    partssubtotal = partssubtotal + Me!part15cost.Value
    End If
    If Not IsNull(Me!part16cost.Value) Then
    partssubtotal = partssubtotal + Me!part16cost.Value
    End If
    If Not IsNull(Me!part17cost.Value) Then
    partssubtotal = partssubtotal + Me!part17cost.Value
    End If
    If Not IsNull(Me!part18cost.Value) Then
    partssubtotal = partssubtotal + Me!part18cost.Value
    End If
    If Not IsNull(Me!part19cost.Value) Then
    partssubtotal = partssubtotal + Me!part19cost.Value
    End If
    If Not IsNull(Me!part20cost.Value) Then
    partssubtotal = partssubtotal + Me!part20cost.Value
    End If

    If Not IsNull(Me!Labor1Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor1Cost.Value
    End If
    If Not IsNull(Me!Labor2Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor2Cost.Value
    End If
    If Not IsNull(Me!Labor3Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor3Cost.Value
    End If
    If Not IsNull(Me!Labor4Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor4Cost.Value
    End If
    If Not IsNull(Me!Labor5Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor5Cost.Value
    End If
    If Not IsNull(Me!Labor6Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor6Cost.Value
    End If
    If Not IsNull(Me!Labor7Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor7Cost.Value
    End If
    If Not IsNull(Me!Labor8Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor8Cost.Value
    End If
    If Not IsNull(Me!Labor9Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor9Cost.Value
    End If
    If Not IsNull(Me!Labor10Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor10Cost.Value
    End If
    If Not IsNull(Me!Labor11Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor11Cost.Value
    End If
    If Not IsNull(Me!Labor12Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor12Cost.Value
    End If
    If Not IsNull(Me!Labor13Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor13Cost.Value
    End If
    If Not IsNull(Me!Labor14Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor14Cost.Value
    End If
    If Not IsNull(Me!Labor15Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor15Cost.Value
    End If
    If Not IsNull(Me!Labor16Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor16Cost.Value
    End If
    If Not IsNull(Me!Labor17Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor17Cost.Value
    End If
    If Not IsNull(Me!Labor18Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor18Cost.Value
    End If
    If Not IsNull(Me!Labor19Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor19Cost.Value
    End If
    If Not IsNull(Me!Labor20Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor20Cost.Value
    End If


    Me!ComParts.Value = partssubtotal * 100
    Me!ComLabor.Value = laborsubtotal * 100
    Me!ComSublet.Value = Me!Sublet.Value * 100
    Me!ComSupplies.Value = Me!Supplies.Value * 100

    Me!partssubtotal.Value = partssubtotal
    Me!TotalParts.Value = partssubtotal
    Me!laborsubtotal.Value = laborsubtotal
    Me!TotalLabor.Value = laborsubtotal
    Me!AshCost.Value = Me!AshCost.Value
    Me!Tax.Value = (Me!TotalParts.Value - Me!AshCost.Value) * 0#
    Me!Total.Value = Me!partssubtotal.Value + Me!laborsubtotal.Value + Me!Supplies.Value + Me!Tax.Value + Me!Sublet.Value
    Me!AmountDue.Value = Me!Total.Value - Me!amountpaid.Value

    Dim db As Database
    Set db = CurrentDb()

    Dim rs As DAO.Recordset
    Set rs = db.OpenRecordset("SELECT * FROM tblOrder", dbOpenDynaset)

    rs.AddNew
    rs!CustomerID = Me!CustomerID.Value
    rs!vehicleid = vehicleSelected
    rs!InvoiceNumber = Me!Invoice
    rs!date = Me!date
    rs!VehicleMileage = Me!Mileage
    rs!Part1Description = Me!Part1Description
    rs!Part1Cost = Me!Part1Cost
    rs!Part2Description = Me!Part2Description
    rs!Part2Cost = Me!Part2Cost
    rs!Part3Description = Me!Part3Description
    rs!Part3Cost = Me!Part3Cost
    rs!Part4Description = Me!Part4Description
    rs!Part4Cost = Me!Part4Cost
    rs!Part5Description = Me!Part5Description
    rs!Part5Cost = Me!Part5Cost
    rs!Part6Description = Me!Part6Description
    rs!Part6Cost = Me!Part6Cost
    rs!Part7Description = Me!Part7Description
    rs!Part7Cost = Me!Part7Cost
    rs!Part8Description = Me!Part8Description
    rs!Part8Cost = Me!Part8Cost
    rs!Part9Description = Me!Part9Description
    rs!Part9Cost = Me!Part9Cost
    rs!Part10Description = Me!Part10Description
    rs!Part10Cost = Me!Part10Cost
    rs!part11description = Me!part11description
    rs!part11cost = Me!part11cost
    rs!part12description = Me!part12description
    rs!part12cost = Me!part12cost
    rs!part13description = Me!part13description
    rs!part13cost = Me!part13cost
    rs!part14description = Me!part14description
    rs!part14cost = Me!part14cost
    rs!part15description = Me!part15description
    rs!part15cost = Me!part15cost
    rs!part16description = Me!part16description
    rs!part16cost = Me!part16cost
    rs!part17description = Me!part17description
    rs!part17cost = Me!part17cost
    rs!part18description = Me!part18description
    rs!part18cost = Me!part18cost
    rs!part19description = Me!part19description
    rs!part19cost = Me!part19cost
    rs!part20description = Me!part20description
    rs!part20cost = Me!part20cost

    rs!Labor1Description = Me!Labor1Description
    rs!Labor1Cost = Me!Labor1Cost
    rs!Labor2Description = Me!Labor2Description
    rs!Labor2Cost = Me!Labor2Cost
    rs!Labor3Description = Me!Labor3Description
    rs!Labor3Cost = Me!Labor3Cost
    rs!Labor4Description = Me!Labor4Description
    rs!Labor4Cost = Me!Labor4Cost
    rs!Labor5Description = Me!Labor5Description
    rs!Labor5Cost = Me!Labor5Cost
    rs!Labor6Description = Me!Labor6Description
    rs!Labor6Cost = Me!Labor6Cost
    rs!Labor7Description = Me!Labor7Description
    rs!Labor7Cost = Me!Labor7Cost
    rs!Labor8Description = Me!Labor8Description
    rs!Labor8Cost = Me!Labor8Cost
    rs!Labor9Description = Me!Labor9Description
    rs!Labor9Cost = Me!Labor9Cost
    rs!Labor10Description = Me!Labor10Description
    rs!Labor10Cost = Me!Labor10Cost
    rs!labor11description = Me!labor11description
    rs!Labor11Cost = Me!Labor11Cost
    rs!labor12description = Me!labor12description
    rs!Labor12Cost = Me!Labor12Cost
    rs!labor13description = Me!labor13description
    rs!Labor13Cost = Me!Labor13Cost
    rs!labor14description = Me!labor14description
    rs!Labor14Cost = Me!Labor14Cost
    rs!labor15description = Me!labor15description
    rs!Labor15Cost = Me!Labor15Cost
    rs!labor16description = Me!labor16description
    rs!Labor16Cost = Me!Labor16Cost
    rs!labor17description = Me!labor17description
    rs!Labor17Cost = Me!Labor17Cost
    rs!labor18description = Me!labor18description
    rs!Labor18Cost = Me!Labor18Cost
    rs!labor19description = Me!labor19description
    rs!Labor19Cost = Me!Labor19Cost
    rs!labor20description = Me!labor20description
    rs!Labor20Cost = Me!Labor20Cost

    rs!Wrecker = Me!Wrecker
    rs!Sublet = Me!Sublet
    rs!TotalParts = Me!partssubtotal
    rs!TotalLabor = Me!laborsubtotal
    rs!Supplies = Me!Supplies
    rs!Tax = Me!Tax
    rs!AshCost = Me!AshCost
    rs!Total = Me!Total
    rs!amountpaid = Me!amountpaid
    rs!AmountDue = Me!AmountDue
    'Save - 4
    rs!PmtType = Me!PmtType

    rs!Part1Q = Me!qty1
    rs!Part2Q = Me!qty2
    rs!Part3Q = Me!qty3
    rs!Part4Q = Me!qty4
    rs!Part5Q = Me!qty5
    rs!Part6Q = Me!qty6
    rs!Part7Q = Me!qty7
    rs!Part8Q = Me!qty8
    rs!Part9Q = Me!qty9
    rs!Part10Q = Me!qty10
    rs!Part11Q = Me!qty11
    rs!Part12Q = Me!qty12
    rs!Part13Q = Me!qty13
    rs!Part14Q = Me!qty14
    rs!Part15Q = Me!qty15
    rs!Part16Q = Me!qty16
    rs!Part17Q = Me!qty17
    rs!Part18Q = Me!qty18
    rs!Part19Q = Me!qty19
    rs!Part20Q = Me!qty20
    rs!part1number = Me!part1number
    rs!part2number = Me!part2number
    rs!part3number = Me!part3number
    rs!part4number = Me!part4number
    rs!part5number = Me!part5number
    rs!part6number = Me!part6number
    rs!part7number = Me!part7number
    rs!part8number = Me!part8number
    rs!part9number = Me!part9number
    rs!part10number = Me!part10number
    rs!part11number = Me!part11number
    rs!part12number = Me!part12number
    rs!part13number = Me!part13number
    rs!part14number = Me!part14number
    rs!part15number = Me!part15number
    rs!part16number = Me!part16number
    rs!part17number = Me!part17number
    rs!part18number = Me!part18number
    rs!part19number = Me!part19number
    rs!part20number = Me!part20number
    rs!comments1 = Me!comments1
    rs!comments2 = Me!comments2
    rs!comments3 = Me!comments3
    rs.Update
    rs.Close
    Me.cmdPrint.SetFocus
    Me.cmdSave.Visible = False
    Me.cmdUpdate.Visible = True

    Dim rs2 As DAO.Recordset
    Set rs2 = db.OpenRecordset("SELECT * FROM tblOrder", dbOpenDynaset)
    rs2.MoveLast
    orderSelected = rs2!OrderID
    rs2.Close

    isPreviousOrder = 1

    End Sub



    Private Sub cmdUpdate_Click()
    Dim partssubtotal As Currency
    Dim laborsubtotal As Currency

    partssubtotal = 0
    laborsubtotal = 0

    If Not IsNull(Me!Part1Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part1Cost.Value
    End If
    If Not IsNull(Me!Part2Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part2Cost.Value
    End If
    If Not IsNull(Me!Part3Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part3Cost.Value
    End If
    If Not IsNull(Me!Part4Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part4Cost.Value
    End If
    If Not IsNull(Me!Part5Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part5Cost.Value
    End If
    If Not IsNull(Me!Part6Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part6Cost.Value
    End If
    If Not IsNull(Me!Part7Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part7Cost.Value
    End If
    If Not IsNull(Me!Part8Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part8Cost.Value
    End If
    If Not IsNull(Me!Part9Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part9Cost.Value
    End If
    If Not IsNull(Me!Part10Cost.Value) Then
    partssubtotal = partssubtotal + Me!Part10Cost.Value
    End If
    If Not IsNull(Me!part11cost.Value) Then
    partssubtotal = partssubtotal + Me!part11cost.Value
    End If
    If Not IsNull(Me!part12cost.Value) Then
    partssubtotal = partssubtotal + Me!part12cost.Value
    End If
    If Not IsNull(Me!part13cost.Value) Then
    partssubtotal = partssubtotal + Me!part13cost.Value
    End If
    If Not IsNull(Me!part14cost.Value) Then
    partssubtotal = partssubtotal + Me!part14cost.Value
    End If
    If Not IsNull(Me!part15cost.Value) Then
    partssubtotal = partssubtotal + Me!part15cost.Value
    End If
    If Not IsNull(Me!part16cost.Value) Then
    partssubtotal = partssubtotal + Me!part16cost.Value
    End If
    If Not IsNull(Me!part17cost.Value) Then
    partssubtotal = partssubtotal + Me!part17cost.Value
    End If
    If Not IsNull(Me!part18cost.Value) Then
    partssubtotal = partssubtotal + Me!part18cost.Value
    End If
    If Not IsNull(Me!part19cost.Value) Then
    partssubtotal = partssubtotal + Me!part19cost.Value
    End If
    If Not IsNull(Me!part20cost.Value) Then
    partssubtotal = partssubtotal + Me!part20cost.Value
    End If

    If Not IsNull(Me!Labor1Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor1Cost.Value
    End If
    If Not IsNull(Me!Labor2Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor2Cost.Value
    End If
    If Not IsNull(Me!Labor3Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor3Cost.Value
    End If
    If Not IsNull(Me!Labor4Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor4Cost.Value
    End If
    If Not IsNull(Me!Labor5Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor5Cost.Value
    End If
    If Not IsNull(Me!Labor6Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor6Cost.Value
    End If
    If Not IsNull(Me!Labor7Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor7Cost.Value
    End If
    If Not IsNull(Me!Labor8Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor8Cost.Value
    End If
    If Not IsNull(Me!Labor9Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor9Cost.Value
    End If
    If Not IsNull(Me!Labor10Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor10Cost.Value
    End If
    If Not IsNull(Me!Labor11Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor11Cost.Value
    End If
    If Not IsNull(Me!Labor12Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor12Cost.Value
    End If
    If Not IsNull(Me!Labor13Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor13Cost.Value
    End If
    If Not IsNull(Me!Labor14Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor14Cost.Value
    End If
    If Not IsNull(Me!Labor15Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor15Cost.Value
    End If
    If Not IsNull(Me!Labor16Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor16Cost.Value
    End If
    If Not IsNull(Me!Labor17Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor17Cost.Value
    End If
    If Not IsNull(Me!Labor18Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor18Cost.Value
    End If
    If Not IsNull(Me!Labor19Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor19Cost.Value
    End If
    If Not IsNull(Me!Labor20Cost.Value) Then
    laborsubtotal = laborsubtotal + Me!Labor20Cost.Value
    End If

    Me!ComParts.Value = partssubtotal * 100
    Me!ComLabor.Value = laborsubtotal * 100
    Me!ComSublet.Value = Me!Sublet.Value * 100
    Me!ComSupplies.Value = Me!Supplies.Value * 100

    Me!partssubtotal.Value = partssubtotal
    Me!TotalParts.Value = partssubtotal
    Me!laborsubtotal.Value = laborsubtotal
    Me!TotalLabor.Value = laborsubtotal
    Me!Tax.Value = (Me!TotalParts.Value - Me!AshCost.Value) * 0#
    Me!AshCost.Value = Me!AshCost.Value
    Me!Total.Value = Me!partssubtotal.Value + Me!laborsubtotal.Value + Me!Supplies.Value + Me!Tax.Value + Me!Sublet.Value
    'Update - 5
    Me!PmtType = PmtType

    Dim db As Database
    Set db = CurrentDb()

    Dim rs As DAO.Recordset
    Set rs = db.OpenRecordset("SELECT * FROM tblOrder where orderid =" & orderSelected, dbOpenDynaset)
    rs.Edit
    rs!InvoiceNumber = Me!Invoice
    rs!date = Me!date
    rs!VehicleMileage = Me!Mileage
    rs!Part1Description = Me!Part1Description
    rs!Part1Cost = Me!Part1Cost
    rs!Part2Description = Me!Part2Description
    rs!Part2Cost = Me!Part2Cost
    rs!Part3Description = Me!Part3Description
    rs!Part3Cost = Me!Part3Cost
    rs!Part4Description = Me!Part4Description
    rs!Part4Cost = Me!Part4Cost
    rs!Part5Description = Me!Part5Description
    rs!Part5Cost = Me!Part5Cost
    rs!Part6Description = Me!Part6Description
    rs!Part6Cost = Me!Part6Cost
    rs!Part7Description = Me!Part7Description
    rs!Part7Cost = Me!Part7Cost
    rs!Part8Description = Me!Part8Description
    rs!Part8Cost = Me!Part8Cost
    rs!Part9Description = Me!Part9Description
    rs!Part9Cost = Me!Part9Cost
    rs!Part10Description = Me!Part10Description
    rs!Part10Cost = Me!Part10Cost
    rs!part11description = Me!part11description
    rs!part11cost = Me!part11cost
    rs!part12description = Me!part12description
    rs!part12cost = Me!part12cost
    rs!part13description = Me!part13description
    rs!part13cost = Me!part13cost
    rs!part14description = Me!part14description
    rs!part14cost = Me!part14cost
    rs!part15description = Me!part15description
    rs!part15cost = Me!part15cost
    rs!part16description = Me!part16description
    rs!part16cost = Me!part16cost
    rs!part17description = Me!part17description
    rs!part17cost = Me!part17cost
    rs!part18description = Me!part18description
    rs!part18cost = Me!part18cost
    rs!part19description = Me!part19description
    rs!part19cost = Me!part19cost
    rs!part20description = Me!part20description
    rs!part20cost = Me!part20cost

    rs!Labor1Description = Me!Labor1Description
    rs!Labor1Cost = Me!Labor1Cost
    rs!Labor2Description = Me!Labor2Description
    rs!Labor2Cost = Me!Labor2Cost
    rs!Labor3Description = Me!Labor3Description
    rs!Labor3Cost = Me!Labor3Cost
    rs!Labor4Description = Me!Labor4Description
    rs!Labor4Cost = Me!Labor4Cost
    rs!Labor5Description = Me!Labor5Description
    rs!Labor5Cost = Me!Labor5Cost
    rs!Labor6Description = Me!Labor6Description
    rs!Labor6Cost = Me!Labor6Cost
    rs!Labor7Description = Me!Labor7Description
    rs!Labor7Cost = Me!Labor7Cost
    rs!Labor8Description = Me!Labor8Description
    rs!Labor8Cost = Me!Labor8Cost
    rs!Labor9Description = Me!Labor9Description
    rs!Labor9Cost = Me!Labor9Cost
    rs!Labor10Description = Me!Labor10Description
    rs!Labor10Cost = Me!Labor10Cost
    rs!labor11description = Me!labor11description
    rs!Labor11Cost = Me!Labor11Cost
    rs!labor12description = Me!labor12description
    rs!Labor12Cost = Me!Labor12Cost
    rs!labor13description = Me!labor13description
    rs!Labor13Cost = Me!Labor13Cost
    rs!labor14description = Me!labor14description
    rs!Labor14Cost = Me!Labor14Cost
    rs!labor15description = Me!labor15description
    rs!Labor15Cost = Me!Labor15Cost
    rs!labor16description = Me!labor16description
    rs!Labor16Cost = Me!Labor16Cost
    rs!labor17description = Me!labor17description
    rs!Labor17Cost = Me!Labor17Cost
    rs!labor18description = Me!labor18description
    rs!Labor18Cost = Me!Labor18Cost
    rs!labor19description = Me!labor19description
    rs!Labor19Cost = Me!Labor19Cost
    rs!labor20description = Me!labor20description
    rs!Labor20Cost = Me!Labor20Cost
    rs!Wrecker = Me!Wrecker
    rs!Sublet = Me!Sublet
    rs!TotalParts = Me!partssubtotal
    rs!TotalLabor = Me!laborsubtotal
    rs!Supplies = Me!Supplies
    rs!Tax = Me!Tax
    rs!AshCost = Me!AshCost
    rs!Total = Me!Total
    rs!amountpaid = Me!amountpaid
    rs!AmountDue = Me!AmountDue
    'Update - 6
    rs!PmtType = Me!PmtType

    rs!Part1Q = Me!qty1
    rs!Part2Q = Me!qty2
    rs!Part3Q = Me!qty3
    rs!Part4Q = Me!qty4
    rs!Part5Q = Me!qty5
    rs!Part6Q = Me!qty6
    rs!Part7Q = Me!qty7
    rs!Part8Q = Me!qty8
    rs!Part9Q = Me!qty9
    rs!Part10Q = Me!qty10
    rs!Part11Q = Me!qty11
    rs!Part12Q = Me!qty12
    rs!Part13Q = Me!qty13
    rs!Part14Q = Me!qty14
    rs!Part15Q = Me!qty15
    rs!Part16Q = Me!qty16
    rs!Part17Q = Me!qty17
    rs!Part18Q = Me!qty18
    rs!Part19Q = Me!qty19
    rs!Part20Q = Me!qty20
    rs!comments1 = Me!comments1
    rs!comments2 = Me!comments2
    rs!comments3 = Me!comments3

    rs!part1number = Me!part1number
    rs!part2number = Me!part2number
    rs!part3number = Me!part3number
    rs!part4number = Me!part4number
    rs!part5number = Me!part5number
    rs!part6number = Me!part6number
    rs!part7number = Me!part7number
    rs!part8number = Me!part8number
    rs!part9number = Me!part9number
    rs!part10number = Me!part10number
    rs!part11number = Me!part11number
    rs!part12number = Me!part12number
    rs!part13number = Me!part13number
    rs!part14number = Me!part14number
    rs!part15number = Me!part15number
    rs!part16number = Me!part16number
    rs!part17number = Me!part17number
    rs!part18number = Me!part18number
    rs!part19number = Me!part19number
    rs!part20number = Me!part20number
    rs.Update
    rs.Close
    End Sub







    Private Sub Form_Load()
    Me!Invoice.SetFocus

    If isPreviousOrder = 0 Then
        Dim db As Database
        Set db = CurrentDb()
        Dim rs As DAO.Recordset
        Set rs = db.OpenRecordset("SELECT tblCustomer.FirstName, tblCustomer.ZIP, tblCustomer.Customerid, tblCustomer.city, tblCustomer.LastName, tblCustomer.Phone1, tblCustomer.Phone2, tblCustomer.Cell, tblCustomer.Pager, tblCustomer.Address, tblVehicle.VIN, tblVehicle.Make, tblVehicle.Model, tblVehicle.LicensePlate, tblVehicle.Transmission, tblVehicle.Engine, tblVehicle.VehicleID FROM tblCustomer INNER JOIN tblVehicle ON tblCustomer.CustomerID = tblVehicle.CustomerID WHERE (((tblVehicle.VehicleID)=" & vehicleSelected & "))", dbOpenDynaset)
            
            Me!FirstName.Value = rs!FirstName
            Me!LastName.Value = rs!LastName
            Me!zip.Value = rs!zip
            Me!City.Value = rs!City
            Me!Address.Value = rs!Address
            Me!Phone1.Value = rs!Phone1
            Me!Phone2.Value = rs!Phone2
            Me!cell.Value = rs!cell
            Me!pager.Value = rs!pager
            Me!Make.Value = rs!Make
            Me!Model.Value = rs!Model
            Me!VIN.Value = rs!VIN
            Me!License.Value = rs!LicensePlate
            Me!Transmission.Value = rs!Transmission
            Me!CustomerID.Value = rs!CustomerID
            Me!vehicleid.Value = vehicleSelected
            Me!Engine.Value = rs!Engine
            rs.Close

            Me!FirstName.SetFocus
            Me!cmdPrint.Visible = True
            Me!cmdCalc.Visible = True
            Me!cmdClose.Visible = True
            Me!cmdSave.Visible = True
            Me!cmdUpdate.Visible = False
            
            Me!date.Value = DateValue(Now)
            
            'invoice load - 1
            Me!PmtType = PmtType
            
    End If

    If isPreviousOrder = 1 Then
        Dim db2 As Database
        Set db2 = CurrentDb()
        Dim rs2 As DAO.Recordset
        
        Dim string1 As String
        Dim string2 As String
        Dim string3 As String
        Dim string4 As String
        Dim string5 As String
        Dim sqlstring As String
        
            string1 = "SELECT tblCustomer.FirstName, tblCustomer.ZIP, tblCustomer.Customerid, tblCustomer.city, tblCustomer.LastName, tblCustomer.Phone1, tblCustomer.Phone2, tblCustomer.Cell, tblCustomer.Pager, tblCustomer.Address, tblVehicle.VIN, tblVehicle.Make, tblVehicle.Model, tblVehicle.LicensePlate, tblVehicle.Engine, tblVehicle.Transmission, tblVehicle.VehicleID, tblOrder.VehicleMileage, tblOrder.OrderID, tblOrder.CustomerID, tblOrder.VehicleID, tblOrder.InvoiceNumber, tblOrder.Date, tblOrder.VehicleMileage, tblorder.Part1Description, tblorder.Part2Description, tblorder.Part3Description, tblorder.Part4Description, tblorder.Part5Description, tblorder.Part6Description, tblorder.Part7Description, tblorder.Part8Description, tblorder.Part9Description, tblorder.Part10Description, tblorder.Part11Description, tblorder.Part12Description, tblorder.Part13Description, tblorder.Part14Description, tblorder.Part15Description, tblorder.Part16Description, tblorder.Part17Description, tblorder.Part18Description, "
            'Query - 2
            string2 = "tblorder.comments1, tblorder.comments2, tblorder.comments3, tblorder.Part20Description, tblorder.part1cost, tblorder.part2cost, tblorder.part3cost, tblorder.part4cost, tblorder.part5cost, tblorder.part6cost, tblorder.part7cost, tblorder.part8cost, tblorder.part9cost, tblorder.part10cost, tblorder.part11cost, tblorder.part12cost, tblorder.part13cost, tblorder.part14cost, tblorder.Part19Description, tblorder.PmtType, "
            string3 = "tblorder.part15cost, tblorder.part16cost, tblorder.part17cost, tblorder.part18cost, tblorder.part19cost, tblorder.part20cost, tblOrder.labor1description, tblOrder.labor2description, tblOrder.labor3description, tblOrder.labor4description, tblorder.labor5description, tblorder.labor6description, tblorder.labor7description, tblorder.labor8description, tblorder.labor9description, tblorder.labor10description, tblorder.labor11description, tblorder.labor12description, tblorder.labor13description, tblorder.labor14description, tblorder.labor15description, tblorder.labor16description, tblorder.labor17description, tblorder.labor18description, tblorder.labor19description, tblorder.labor20description, tblorder.labor1cost, tblorder.labor2cost, tblorder.labor3cost, tblorder.labor4cost, tblorder.labor5cost, tblorder.labor6cost, tblorder.labor7cost, tblorder.labor8cost, tblorder.labor9cost, tblorder.labor10cost, tblorder.labor11cost, tblorder.labor12cost, tblorder.labor13cost, tblorder.labor14cost, "
            string4 = "tblorder.labor15cost, tblorder.labor16cost, tblorder.labor17cost, tblorder.labor18cost, tblorder.labor19cost, tblorder.labor20cost, tblorder.wrecker, tblorder.sublet, tblorder.totalparts, tblorder.totallabor, tblorder.supplies, tblorder.tax, tblorder.ashcost, tblorder.total, tblorder.amountpaid, tblorder.amountdue,tblorder.part1q, tblorder.part2q, tblorder.part3q, tblorder.part4q, tblorder.part5q, tblorder.part6q, tblorder.part7q, tblorder.part8q, tblorder.part9q, tblorder.part10q, tblorder.part11q, tblorder.part12q, tblorder.part13q, tblorder.part14q, tblorder.part15q, tblorder.part16q, tblorder.part17q, tblorder.part18q, tblorder.part19q, tblorder.part20q, tblorder.part1number, tblorder.part2number, tblorder.part3number, tblorder.part4number, tblorder.part5number, tblorder.part6number, tblorder.part7number, tblorder.part8number, tblorder.part9number, tblorder.part10number, tblorder.part11number, tblorder.part12number, tblorder.part13number, tblorder.part14number, tblorder.part15number, "
            string5 = "tblorder.part16number, tblorder.part17number, tblorder.part18number, tblorder.part19number, tblorder.part20number, tblorder.wrecker FROM (tblCustomer INNER JOIN tblOrder ON tblCustomer.CustomerID = tblOrder.CustomerID) INNER JOIN tblVehicle ON (tblOrder.VehicleID = tblVehicle.VehicleID) AND (tblCustomer.CustomerID = tblVehicle.CustomerID) WHERE tblorder.orderid =" & orderSelected
            sqlstring = string1 & string2 & string3 & string4 & string5

        Set rs2 = db2.OpenRecordset(sqlstring, dbOpenDynaset)
        
        'rs2 - 3
        Me!PmtType.Value = rs2!PmtType
        
        Me!FirstName.Value = rs2!FirstName
        Me!LastName.Value = rs2!LastName
        Me!Address.Value = rs2!Address
        Me!Phone1.Value = rs2!Phone1
        Me!Phone2.Value = rs2!Phone2
        Me!cell.Value = rs2!cell
        Me!pager.Value = rs2!pager
        Me!City.Value = rs2!City
        Me!zip.Value = rs2!zip
        Me!Make.Value = rs2!Make
        Me!Model.Value = rs2!Model
        Me!VIN.Value = rs2!VIN
        Me!Mileage.Value = rs2!VehicleMileage
        Me!Engine.Value = rs2!Engine
        Me!Transmission.Value = rs2!Transmission
        Me!License.Value = rs2!LicensePlate
        Me!Invoice.Value = rs2!InvoiceNumber
        Me!date.Value = rs2!date
        Me!Part1Cost.Value = rs2!Part1Cost
        Me!Part2Cost.Value = rs2!Part2Cost
        Me!Part3Cost.Value = rs2!Part3Cost
        Me!Part4Cost.Value = rs2!Part4Cost
        Me!Part5Cost.Value = rs2!Part5Cost
        Me!Part6Cost.Value = rs2!Part6Cost
        Me!Part7Cost.Value = rs2!Part7Cost
        Me!Part8Cost.Value = rs2!Part8Cost
        Me!Part9Cost.Value = rs2!Part9Cost
        Me!Part10Cost.Value = rs2!Part10Cost
        Me!part11cost.Value = rs2!part11cost
        Me!part12cost.Value = rs2!part12cost
        Me!part13cost.Value = rs2!part13cost
        Me!part14cost.Value = rs2!part14cost
        Me!part15cost.Value = rs2!part15cost
        Me!part16cost.Value = rs2!part16cost
        Me!part17cost.Value = rs2!part17cost
        Me!part18cost.Value = rs2!part18cost
        Me!part19cost.Value = rs2!part19cost
        Me!part20cost.Value = rs2!part20cost
        Me!Part1Description.Value = rs2!Part1Description
        Me!Part2Description.Value = rs2!Part2Description
        Me!Part3Description.Value = rs2!Part3Description
        Me!Part4Description.Value = rs2!Part4Description
        Me!Part5Description.Value = rs2!Part5Description
        Me!Part6Description.Value = rs2!Part6Description
        Me!Part7Description.Value = rs2!Part7Description
        Me!Part8Description.Value = rs2!Part8Description
        Me!Part9Description.Value = rs2!Part9Description
        Me!Part10Description.Value = rs2!Part10Description
        Me!part11description.Value = rs2!part11description
        Me!part12description.Value = rs2!part12description
        Me!part13description.Value = rs2!part13description
        Me!part14description.Value = rs2!part14description
        Me!part15description.Value = rs2!part15description
        Me!part16description.Value = rs2!part16description
        Me!part17description.Value = rs2!part17description
        Me!part18description.Value = rs2!part18description
        Me!part19description.Value = rs2!part19description
        Me!part20description.Value = rs2!part20description
        Me!qty1.Value = rs2!Part1Q
        Me!qty2.Value = rs2!Part2Q
        Me!qty3.Value = rs2!Part3Q
        Me!qty4.Value = rs2!Part4Q
        Me!qty5.Value = rs2!Part5Q
        Me!qty6.Value = rs2!Part6Q
        Me!qty7.Value = rs2!Part7Q
        Me!qty8.Value = rs2!Part8Q
        Me!qty9.Value = rs2!Part9Q
        Me!qty10.Value = rs2!Part10Q
        Me!qty11.Value = rs2!Part11Q
        Me!qty12.Value = rs2!Part12Q
        Me!qty13.Value = rs2!Part13Q
        Me!qty14.Value = rs2!Part14Q
        Me!qty15.Value = rs2!Part15Q
        Me!qty16.Value = rs2!Part16Q
        Me!qty17.Value = rs2!Part17Q
        Me!qty18.Value = rs2!Part18Q
        Me!qty19.Value = rs2!Part19Q
        Me!qty20.Value = rs2!Part20Q
        Me!part1number.Value = rs2!part1number
        Me!part2number.Value = rs2!part2number
        Me!part3number.Value = rs2!part3number
        Me!part4number.Value = rs2!part4number
        Me!part5number.Value = rs2!part5number
        Me!part6number.Value = rs2!part6number
        Me!part7number.Value = rs2!part7number
        Me!part8number.Value = rs2!part8number
        Me!part9number.Value = rs2!part9number
        Me!part10number.Value = rs2!part10number
        Me!part11number.Value = rs2!part11number
        Me!part12number.Value = rs2!part12number
        Me!part13number.Value = rs2!part13number
        Me!part14number.Value = rs2!part14number
        Me!part15number.Value = rs2!part15number
        Me!part16number.Value = rs2!part16number
        Me!part17number.Value = rs2!part17number
        Me!part18number.Value = rs2!part18number
        Me!part19number.Value = rs2!part19number
        Me!part20number.Value = rs2!part20number
        Me!Labor1Description.Value = rs2!Labor1Description
        Me!Labor2Description.Value = rs2!Labor2Description
        Me!Labor3Description.Value = rs2!Labor3Description
        Me!Labor4Description.Value = rs2!Labor4Description
        Me!Labor5Description.Value = rs2!Labor5Description
        Me!Labor6Description.Value = rs2!Labor6Description
        Me!Labor7Description.Value = rs2!Labor7Description
        Me!Labor8Description.Value = rs2!Labor8Description
        Me!Labor9Description.Value = rs2!Labor9Description
        Me!Labor10Description.Value = rs2!Labor10Description
        Me!labor11description.Value = rs2!labor11description
        Me!labor12description.Value = rs2!labor12description
        Me!labor13description.Value = rs2!labor13description
        Me!labor14description.Value = rs2!labor14description
        Me!labor15description.Value = rs2!labor15description
        Me!labor16description.Value = rs2!labor16description
        Me!labor17description.Value = rs2!labor17description
        Me!labor18description.Value = rs2!labor18description
        Me!labor19description.Value = rs2!labor19description
        Me!labor20description.Value = rs2!labor20description
        Me!Labor1Cost.Value = rs2!Labor1Cost
        Me!Labor2Cost.Value = rs2!Labor2Cost
        Me!Labor3Cost.Value = rs2!Labor3Cost
        Me!Labor4Cost.Value = rs2!Labor4Cost
        Me!Labor5Cost.Value = rs2!Labor5Cost
        Me!Labor6Cost.Value = rs2!Labor6Cost
        Me!Labor7Cost.Value = rs2!Labor7Cost
        Me!Labor8Cost.Value = rs2!Labor8Cost
        Me!Labor9Cost.Value = rs2!Labor9Cost
        Me!Labor10Cost.Value = rs2!Labor10Cost
        Me!Labor11Cost.Value = rs2!Labor11Cost
        Me!Labor12Cost.Value = rs2!Labor12Cost
        Me!Labor13Cost.Value = rs2!Labor13Cost
        Me!Labor14Cost.Value = rs2!Labor14Cost
        Me!Labor15Cost.Value = rs2!Labor15Cost
        Me!Labor16Cost.Value = rs2!Labor16Cost
        Me!Labor17Cost.Value = rs2!Labor17Cost
        Me!Labor18Cost.Value = rs2!Labor18Cost
        Me!Labor19Cost.Value = rs2!Labor19Cost
        Me!Labor20Cost.Value = rs2!Labor20Cost
        Me!Wrecker.Value = rs2!Wrecker
        Me!Sublet.Value = rs2!Sublet
        Me!TotalParts.Value = rs2!TotalParts
        Me!TotalLabor.Value = rs2!TotalLabor
        Me!Supplies.Value = rs2!Supplies
        Me!AshCost.Value = rs2!AshCost
        Me!Tax.Value = rs2!Tax
        Me!Total.Value = rs2!Total
        
        Me!amountpaid.Value = rs2!amountpaid
        Me!AmountDue.Value = rs2!AmountDue
        Me!partssubtotal.Value = rs2!TotalParts
        Me!laborsubtotal.Value = rs2!TotalLabor
        Me!comments1.Value = rs2!comments1
        Me!comments2.Value = rs2!comments2
        Me!comments3.Value = rs2!comments3
        
        Me!ComParts.Value = rs2!TotalParts * 100
        Me!ComLabor.Value = rs2!TotalLabor * 100
        Me!ComSublet.Value = rs2!Sublet * 100
        Me!ComSupplies.Value = rs2!Supplies * 100
        
        Me!cmdPrint.Visible = True
        Me!cmdCalc.Visible = True
        Me!cmdClose.Visible = True
        Me!cmdSave.Visible = False
        Me!cmdUpdate.Visible = True
        Me!Invoice.Visible = True
        Me!Mileage.Visible = True
        Me!Invoice.Locked = False
        Me!Mileage.Locked = False
        Me!date.Locked = False
        Me!cmdCalc.Enabled = True
        
        
    End If
    End Sub
    Private Sub cmdPrint_Click()
    On Error GoTo Err_cmdPrint_Click
    Me!FirstName.SetFocus
    Me!cmdPrint.Visible = False
    Me!cmdPrint2.Visible = False
    Me!cmdCalc.Visible = False
    Me!cmdClose.Visible = False
    Me!cmdSave.Visible = False
    Me!cmdUpdate.Visible = False
    Me!AshCost.Visible = False
    Me!LabelAshCost.Visible = False

        
        DoCmd.PrintOut acPages, 1, 1, acMedium, 1, True
            
    If isPreviousOrder = 0 Then
            Me!cmdPrint.Visible = True
            Me!cmdPrint2.Visible = True
            Me!cmdCalc.Visible = True
            Me!cmdClose.Visible = True
            Me!cmdSave.Visible = True
            Me!cmdUpdate.Visible = False
    Else:   Me!cmdPrint.Visible = True
            Me!cmdPrint2.Visible = True
            Me!cmdCalc.Visible = True
            Me!cmdClose.Visible = True
            Me!cmdSave.Visible = False
            Me!cmdUpdate.Visible = True
            Me!cmdCalc.Enabled = True

    End If
    Exit_cmdPrint_Click:
        Exit Sub

    Err_cmdPrint_Click:
        MsgBox Err.Description
        Resume Exit_cmdPrint_Click
        
    End Sub
    Private Sub cmdClose_Click()
    On Error GoTo Err_cmdClose_Click

    If Me.cmdSave.Visible = True Then
        If vbYes = MsgBox("Order has not been saved. Would you like to return to save the order?", vbYesNo, "Order Not Saved") Then
        Else:
            DoCmd.Close
        End If
    Else
    DoCmd.Close
    End If
        
    Exit_cmdClose_Click:
        Exit Sub

    Err_cmdClose_Click:
        MsgBox Err.Description
        Resume Exit_cmdClose_Click
        
    End Sub

    Private Sub inspection_Click()

    Me!Labor8Description = "STATE INSPECTION      ( SUBLET )"
    Me!Sublet.Value = Me!Sublet.Value + "$25.50"

    End Sub

    Private Sub Invoice_BeforeUpdate(Cancel As Integer)

    End Sub

    Private Sub Mileage_BeforeUpdate(Cancel As Integer)

    End Sub

    Private Sub oilchange_Click()

    Me!Part2Description = "OIL AND FILTER"
    Me!Part2Cost = "$19.95"
    Me!Part3Description = "( CASTROL GTX )"
    Me!Labor2Description = "CHANGED ENGINE OIL AND FILTER"
    Me!Labor2Cost = "$10.00"

    End Sub

    Private Sub rotatetires_Click()

    Me!Labor3Description = "ROTATED TIRES"
    Me!Labor3Cost = "$0.00"

    End Sub

    Private Sub syntheticoilchange_Click()

    Me!Part2Description = "SYNTHETIC OIL"
    Me!Part2Cost = "$54.95"
    Me!Part3Description = "OIL FILTER"
    Me!Part3Cost = "$8.00"
    Me!Labor2Description = "CHANGED ENGINE OIL AND FILTER"
    Me!Labor2Cost = "$12.00"

    End Sub

    Private Sub airfilter_Click()

    Me!Part4Description = "AIR FILTER"
    Me!Part4Cost = "$13.00"
    Me!Labor4Description = "REPLACED AIR FILTER"
    Me!Labor4Cost = "$0.00"

    End Sub

    Private Sub acfilter_Click()

    Me!Part5Description = "A/C CABIN FILTER"
    Me!Part5Cost = "$25.00"
    Me!Labor5Description = "REPLACED A/C CABIN FILTER"
    Me!Labor5Cost = "$0.00"

    End Sub

    Private Sub wiperblades_Click()

    Me!Part6Description = "WIPER BLADES x 2"
    Me!Part6Cost = "$15.00"
    Me!Labor6Description = "REPLACED BOTH FRONT WIPER BLADES"
    Me!Labor6Cost = "$0.00"

    End Sub

    Private Sub battery_Click()

    Me!Part7Description = "BATTERY    (  )"
    Me!Part7Cost = "$110.00"
    Me!Labor7Description = "REPLACED BATTERY"
    Me!Labor7Cost = "$0.00"

    End Sub

    Private Sub zip_AfterUpdate()

    End Sub

    Private Sub zip_BeforeUpdate(Cancel As Integer)

    End Sub
    Private Sub btnPmtType_Click()
    On Error GoTo Err_btnPmtType_Click

        Dim stDocName As String
        Dim stLinkCriteria As String

        stDocName = "tblOrder pmtType"
        DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_btnPmtType_Click:
        Exit Sub

    Err_btnPmtType_Click:
        MsgBox Err.Description
        Resume Exit_btnPmtType_Click
        
    End Sub
    Private Sub Command336_Click()
    On Error GoTo Err_Command336_Click


        Screen.PreviousControl.SetFocus
        DoCmd.RunCommand acCmdAutoDial

    Exit_Command336_Click:
        Exit Sub

    Err_Command336_Click:
        Resume Next
        Resume Exit_Command336_Click
        
    End Sub

    Tuesday, February 27, 2018 9:58 PM
  • Hi David,

    Thanks. It might take a while to read all that. In the meantime, going back to your original post, did you say you're specifically getting the "object required" error in this set of code?

    
    Private Sub btnCC_Click()
    
         PmtType.Value = "CC"
    
    End Sub

    If you're using a button's Click event, you must be using a Form, correct? Are you saying there are no Textboxes on this form? If there are, can you please confirm there is a Textbox called "PmtType" in it? If not, what is in the Record Source property of the form? Is PmtType included in the Record Source?

    Perhaps it would also help if you could post some screenshots of the form as well.

    Just a thought...

    Tuesday, February 27, 2018 10:25 PM
  • That is correct, the error only occurs in the button code.

    There is no textbox for pmttype on the form.

    As mentioned at the beginning, this exact same code

    works fine in 2 test environments, it fails when
    putting the exact same code in production environment.


    Wednesday, February 28, 2018 11:52 AM
  • Looking at your code I cannot figure out what type of object PmtType is. I see several references. Some are fully qualified (e.g. rs, ME) some are not, which is very risky if you are using the same name for different variables.

    The error you see is indicating that PmtType cannot be resolved. You will probably need to fully qualify it. If this isn't the problem then you should check the References in the database on the machine where the issue occurs to make sure that none are missing. Missing or unresolved References can cause unexpected VBA code errors.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 28, 2018 2:20 PM
  • PmtType is Text

    All references are identical on all machines, test and production

    nothing shows as "missing" in reference tabs.

    Wednesday, February 28, 2018 2:56 PM
  • PmtType is Text

    All references are identical on all machines, test and production

    nothing shows as "missing" in reference tabs.

    But what is the data type of the variable PmtType? It can't be Text. I can see it has a Value property, which can be Text, but it is an object of some type. The problem is in identifying PmtType. Within the scope it is used Access 2007 cannot figure out what it is.

    Relying on default behavior can be problematic, especially when you are running in different versions of Microsoft Access. You are not guaranteed the same behavior regardless of whether you are using the same database.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, February 28, 2018 3:28 PM
  • That is correct, the error only occurs in the button code.

    There is no textbox for pmttype on the form.

    As mentioned at the beginning, this exact same code

    works fine in 2 test environments, it fails when
    putting the exact same code in production environment.


    Hi,

    Based on your reply, I would normally suspect you are getting the "object required" error because Access is looking for a textbox called PmtType, which you say does not exist. This would make sense if it exists in the other two test environments, which would explain why you're not getting the error there.

    However, if you're saying that you're using the "exact same form" rather than the "exact same code" in all environments, then I would tend to agree with Paul that there is an "object" somewhere in your database that you are missing in the one environment but exists in the other two.

    Just my 2 cents...

    Wednesday, February 28, 2018 4:04 PM
  • Hello,

    If you type such as "Me.Pmt" , will VBE help you complete rest intelligently?

    Could you share a simply database file so we could try to reproduce your issue?

    For sharing file, you could share the file via Cloud Storage, such as One Drive, and then put link address here. Thanks for understanding.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 1, 2018 6:05 AM
  • It is difficult to read your code, could you share us a simple database which could reproduce your issue?

    >> PmtType.Value = "CC"

    What is PmtType? What do you want to achieve by this line?

    In generel,  PmtType should be a control in the Form, but based on your description, it seems not. 

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 2, 2018 7:44 AM