Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN TIME ERROR 91: Object variable or with block variable not set

Status
Not open for further replies.

MrsMope

Technical User
Joined
Oct 18, 2004
Messages
125
Location
US
hello I get the RUNTIME error during the following function :

Code:
Private Sub Form_Load()
If TableExists("tmpJobTime") Then
    DoCmd.DeleteObject acTable, "tmpJobTime"
Else
    DoCmd.OpenStoredProcedure "spJobTime"
End If
End Sub

Public Function TableExists(sTable As String) As Boolean
    
    Dim db As database
    Dim tbl As TableDef
    Set db = CurrentDb()
    
    TableExists = False
    
    For Each tbl In db.TableDefs
        If tbl.Name = sTable Then
            TableExists = True
    Next tbl
    
End Function
it looks like my db is set to nothing
 
You must have the DAO library ticked in your References, and then this line:
Dim db As database
should be automatically changed to this:
Dim db As Database

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top