Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 23rd, 2007, 10:43 PM
Registered User
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to DeannaF829 Send a message via Yahoo to DeannaF829
Default Compile Error: Object required

Hello there. I am trying to pull order data from an Access db using VB6 and I get a Compile Error: Object Required error and I've been searching the internet for an answer, but haven't found any that help...
Here is my code:

Public Function RecordImport(ByVal strKeyValue As String, Optional strDateCreated As String) As FSIO.Recordset

    On Error GoTo RecordImport_Error

    ' Declare variables for procedure
    Dim objRecordset As FSIO.Recordset
    Dim strSQL As String
    Dim ship_id As String
    Dim order_id As String
    Dim trim_order_id As String
    Dim to_company_id As String

    ' Validate Connection object
    If Not InstantiateConnection Then Exit Function

    ' Validate Connection state
    If Not GetConnection Then Exit Function

    ' Create the recordset object
    Set objRecordset = ODBC1.CreateRecordSet

    ' Set SQL statement
    Set ship_id = "'" & strKeyValue & "'"

It highlights the whole Public Function line in yellow, and the variable ship_id in gray.

I can't figure out what the problem is.

Thanks in advance.


Old April 24th, 2007, 07:12 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there..

since ship_id is a string you don't need the set in front of it... You only use set when you are referencing objects in vb6 (set is deprecated in .net)



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Required Error JeffGirard Access 5 October 2nd, 2009 08:09 AM
Object Required error voyeur Javascript 9 January 25th, 2008 11:50 AM
Object required: 'rs' error hastikeyvan Classic ASP Basics 3 March 14th, 2006 07:34 AM
Object required error ?? hman SQL Server ASP 11 June 21st, 2004 10:59 AM
error....Object required: '' sassenach Classic ASP Databases 2 August 4th, 2003 03:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.