Object Variable or With Block Dilema!!!

When I run my Visual Basic Project after running with a full compile everything works fine. But, when I make a EXE and run it it comes back and tells me that the Object Variable or WIth Block variable is not set.  Why here and not after I compile. How am I suppsoe to debug this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try putting:

   Option Explicit

In the Declarations Section of all of your forms and modules...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Run the application in VB again and try to recreate the exact spot where the error occurs.  You may find that you are missing an object declaration somewhere after all.  Compilation does not necessarily catch all errors, if it did there would be no such thing as run-time erros in VB.
NelmarcasAuthor Commented:

The error still occured after I made sure that the Option Explicit Statement was at the head of all my objects.

Unfortunately this is where it happened:

Public Function Add(TheContainer As Object) As Long
Dim ps            As rdoQuery
Dim rs            As rdoResultset
Dim SQL           As String
Dim RetCode       As Long
Dim TheAddressID  As Long

  On Error GoTo AddressAddError

  ReturnCode = 0
  Screen.MousePointer = vbHourglass
  SQL = " execute Global..Add_Address " & _
            " 0 ," & _
            " 'Adding' , " & _
            "'Adding' , " & _
            "'Adding' , " & _
            "'Adding' , " & _
            "'Adding' , " & _
            "'Adding' , " & _
            "'Adding' , "
  SQL = SQL & "'Ad' , " & _
            "'Adding' , " & _
            "'Add' , " & _
            "'Add' , " & _
            "'XXX' "
  Set ps = Rover.TheConnection.CreatePreparedStatement("MyPs", SQL)
  ps.RowsetSize = 1
  Set rs = ps.OpenResultset(rdOpenForwardOnly)

  TheAddressID = rs(0)'HERE!!!!!!!
'here is where I get the error that the Object Collection: Couldn't find item indicated by text occurs.  Funny it runs on my workstation just fine.  But On my partners it coughs. ANy ideas???

  RetCode = Edit(TheAddressID, TheContainer)
  If RetCode Then
    Add = TheAddressID
    Add = 0
  End If
  Screen.MousePointer = vbDefault
  Exit Function
  Rover.CBPErr.Number = Err.Number
  Select Case Rover.CBPErr.Action
  Case vbAbort
    Add = False
    Exit Function
  Case vbRetry
  Case Else
    Resume Next
  End Select
End Function
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Try adding the line set rs = new rdo.resultset before the line giving you the error

Sorry add that line before your current set rs line
NelmarcasAuthor Commented:
Nope, VB wouldn't allow me to do that.
The line should have read
set rs = new rdoResultset '(no dot)

But why wouldn't VB allow you to do that?
NelmarcasAuthor Commented:
Invalid use of New Keyword.
From the Vb help file


The following example shows how to create an rdoResultset in code and pass it to an existing RemoteData control:

Option Explicit
Dim qy As rdoQuery
Dim rs As rdoResultset
Dim cn As rdoConnection

Private Sub Form_Load()
Dim SQL As String
Set cn = MSRDC1.Connection

SQL = "{ call ChooseAuthor (?) }"
Set qy = cn.CreateQuery("GetAuthor", SQL)
End Sub

Private Sub Search_Click()
qy(0) = NameWanted.Text
Set MSRDC1.Resultset = qy.OpenResultset( _
   rdOpenStatic, rdConcurReadOnly)

End Sub

Try this syntax and see what happens
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.