Results 1 to 3 of 3

Thread: object variable or with block not set...HELP!!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Ive got an error in my vb module saying:

    "object variable or with block not set"

    What does this mean??heres my code below:

    Public Sub Fetch_GeneralAdmin()

    Dim objFetch_GeneralAdmin As New DCGeneraladmin.DcGeneralAdminClass, mysql As String

    Dim rs As New ADODB.Recordset
    Set rs = objFetch_GeneralAdmin.Fetch_GeneralAdmin
    On Error Resume Next
    g_objSC.Response.Write "<TABLE><TR><TH>General Admin</TH></TR>" & vbCrLf

    rs.Open

    g_objSC.Response.Write "<TR><TD>Claim Date Range</TD><TD><input type=text id=txtclaimdaterange name=txtclaimdaterange maxlength=20 value=" & rs.Fields("claimdaterange") & "></TD></TR>" & vbCrLf

    g_objSC.Response.Write "</TABLE>"
    rs.Close
    Set rs = Nothing
    Set objFetch_GeneralAdmin = Nothing
    Err = 0
    End Sub
    Gilly

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    Hi!


    Ive got an error in my vb module saying:

    "object variable or with block not set"

    What does this mean??heres my code below:

    Public Sub Fetch_GeneralAdmin()

    Dim objFetch_GeneralAdmin As New DCGeneraladmin.DcGeneralAdminClass, mysql As String

    Dim rs As New ADODB.Recordset
    Set rs = objFetch_GeneralAdmin.Fetch_GeneralAdmin

    'I am sure you've taken care of this... But I will just
    'ask a couple of questions
    1. The method you're invoking
    Fetch_GeneralAdmin

    returns an ADODB recordset... right?
    Are you re returning to this? or is it dying inside
    the method?

    If it is returning set a break point on the line
    Set Rs = .....

    and look at rs

    In any case, I'd check the method....

    Post it, if u can
    Another set of eyes could help

    Take care...



    On Error Resume Next
    g_objSC.Response.Write "<TABLE><TR><TH>General Admin</TH></TR>" & vbCrLf

    rs.Open

    g_objSC.Response.Write "<TR><TD>Claim Date Range</TD><TD><input type=text id=txtclaimdaterange name=txtclaimdaterange maxlength=20 value=" & rs.Fields("claimdaterange") & "></TD></TR>" & vbCrLf

    g_objSC.Response.Write "</TABLE>"
    rs.Close
    Set rs = Nothing
    Set objFetch_GeneralAdmin = Nothing
    Err = 0
    End Sub



  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    "object variable or with block not set"
    means probably in this case that you're trying to access an object using a object reference that contains nothing.

    You may have used set to set the object but that doesn't mean it's set, if the object you've set it to is nothing.

    Now you could check this by typing
    [ode]
    If thatobject is nothing then 'oh that object is nothing!! don't try to access it.
    else
    'access it
    thatobject.dowhatever
    end if
    [/code]
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width