Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 23rd, 2007, 10:43 PM
Registered User
Join Date: Apr 2007
Location: Shrewsbury, MA, USA.
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.


Reply With Quote
  #2 (permalink)  
Old April 24th, 2007, 07:12 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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?):
================================================== =========
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 06:37 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.