RunTime Error 424 : Object Required (1 Viewer)

jackb1117

New member
Local time
Today, 04:07
Joined
Mar 11, 2010
Messages
5
Hey Guys,


Having an issue with what I thought would be a simple couple lines of code, but I keep getting kicked a run-time error (object required), and I can't figure out why.

Basically I have a form where a user has selected a couple values from a dropdown element, and entered a few other text values into the form. I am then trying to grab the values and append them to a table. Not sure what is going wrong- any help or guidance you can provide would be greatly appreciated.

Code:
Private Sub btnSubmitInputVendorPerformanceForm_Click() 'Button Is part of frmInputVendorPerformance

Dim ValueCheck As Integer 'Increments to make sure no errors in entry
Dim ErrorShow As String
Dim YesorNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
Dim DeliveryRate As String
Dim FailedBounced As String
Dim FailRate As String
Dim OpenRate As String
Dim ClickRate As String
Dim NoResponse As String
Dim NoResponseRate As String
Dim DropOutRate As String
Dim PureIncidenceRate As String
Dim PureTerminateRate As String
Dim CommunityDuplicateRate As String
Dim suspiciousRate As String
Dim OtherBackEndScreenoutRate As String
Dim FinalIncidenceRate As String
Dim NotInvitedButQualified As String
Dim ConversionRate As String
Dim CostPerLogin As String
Dim CostPerResponse As String
Dim CostPerInvited As String
Dim TargetingPerformanceCostPerMember As String
Dim additionalCostPerMember As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim sqry As String
Dim CurrentVersion As String

 ValueCheck = 0 'Sets value-check to default no-error value
ErrorShow = ""

If lstSelectProject.Value = "" Then
    MsgBox "Please select a project.", vbCritical
    Exit Sub
End If

'handling for exception: validation costs only 
Dim rs_ex As ADODB.Recordset
Set rs_ex = New ADODB.Recordset
sqry = "SELECT Type FROM tblVendors WHERE VendorID = " & inputAddVendorPerformanceVendor.Value & ";"
rs_ex.Open sqry, CurrentProject.Connection, adOpenStatic
If rs_ex!Type = "Validation" Then
    If IsNumeric(inputTotalProjectCost.Value) = False Or IsNull(inputTotalProjectCost.Value) Or inputTotalProjectCost.Value < 0 Then  'If number is not valid...
      
       ValueCheck = ValueCheck + 1
        ErrorShow = ErrorShow + "Total Project Cost" + vbNewLine
    End If

    If IsNumeric(inputFixedProjectCost.Value) = False Or IsNull(inputFixedProjectCost.Value) Or inputFixedProjectCost.Value < 0 Then  'If number is not valid...
      ValueCheck = ValueCheck + 1
        ErrorShow = ErrorShow + "Fixed Project Cost" + vbNewLine
    End If
    
    If ValueCheck = 0 Then
    
' ERROR KICKED BELOW
   
  [B]      sqry = _
            "INSERT INTO tblVendorPerformance (ProjectRefNum, VendorID, TotalProjectCost, FixedProjectCost, Notes) " & _
            "VALUES ('" & inputAddVendorPerformanceProject.Value & "', " & inputAddVendorPerformanceVendor & ", " & _
                inputTotalProjectCost.Value & ", " & inputFixedProjectCost.Value & ", '" & inputNotes.Value & " ');"[/B]

        DoCmd.SetWarnings False
        DoCmd.RunSQL sqry
        DoCmd.SetWarnings True

Thanks again so much, and please let me know if any other information would be useful.

Cheers!
 
Last edited:

ByteMyzer

AWF VIP
Local time
Today, 01:07
Joined
May 3, 2004
Messages
1,409
You might try the following addition (highlighted in Blue):
sqry = _
"INSERT INTO tblVendorPerformance (ProjectRefNum, VendorID, TotalProjectCost, FixedProjectCost, Notes) " & _
"VALUES ('" & inputAddVendorPerformanceProject.Value & "', " & inputAddVendorPerformanceVendor.Value & ", " & _
inputTotalProjectCost.Value & ", " & inputFixedProjectCost.Value & ", '" & inputNotes.Value & " ');"
 

jackb1117

New member
Local time
Today, 04:07
Joined
Mar 11, 2010
Messages
5
Thanks for the reply!

I did try that, with the same result, which makes me wonder if it has to do with something other than the SQL syntax that particular line is building. I will try again in the morning in case I am mistakenly remembering trying that, and will check back in.

Cheers,

J
 

JHB

Have been here a while
Local time
Today, 10:07
Joined
Jun 17, 2012
Messages
7,732
I suppose that inputAddVendorPerformanceProject, inputAddVendorPerformanceVendor, inputTotalProjectCost, inputFixedProjectCost and inputNotes are controls, correct?
Then putting a Me. in front of them, (then you'll see if they exist on the form), because the error message lead to an unknow or misspelled controlname.
 

jackb1117

New member
Local time
Today, 04:07
Joined
Mar 11, 2010
Messages
5
Yup, I am embarrassed. Tossed the me. in front of the control names, and realized that it was trying to call a control I had renamed, hence the error. Thanks for the help folks!
 

Users who are viewing this thread

Top Bottom