Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 24th, 2006, 05:01 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default object variable or with block variable not set

I don't know why I keep getting this msg?!? Code below...help!!

Option Compare Database
Option Explicit

Private Sub Save_IP_Type_Button_Click()
On Error GoTo Error_Sub

    Dim inputTypeID As Variant
    Dim inputType As Variant
    inputTypeID = Me!IPTypeID
    inputType = Me!IPType

    If IsNull(inputTypeID) Then
        MsgBox "You must enter an IP acronym!", vbExclamation, "No Acronym Entered"
    ElseIf IsNull(inputType) Then
        MsgBox "You must enter an IP type!", vbExclamation, "No Type Entered"
    Else
        Dim table As Recordset
        Set table = globalDatabase.OpenRecordset("SELECT * FROM IPTypeLookup WHERE IPTypeID='" & inputTypeID & "';", dbOpenForwardOnly)
        If Not table.BOF And table.EOF Then ' If the acronym entered is already in use
            table.Close
            MsgBox "IP acronym is already in use!", vbExclamation, "Duplicate IP Acronym"
            Exit Sub
        End If
        table.Close
        Set table = globalDatabase.OpenRecordset("SELECT * FROM IPTypeLookup WHERE Type='" & inputType & "';", dbOpenForwardOnly)
        If table.BOF And table.EOF Then ' If the IP Type entered does not exist
            table.Close
            Set table = globalDatabase.OpenRecordset("IPTypeLookup", dbOpenTable)
            table.AddNew
            table!IPTypeID = inputTypeID
            table!Type = inputType
            table.Update
            table.Close
            DoCmd.Close acForm, Me.Name
        Else ' If the IP Type entered does exist
            table.Close
            MsgBox "IP type already exists!", vbExclamation, "Duplicate IP Type"
        End If
    End If

Exit_Sub:
    Exit Sub

Error_Sub:
    MsgBox err.Description
    Resume Exit_Sub
End Sub
Reply With Quote
  #2 (permalink)  
Old February 24th, 2006, 05:21 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

how do you find out what line is causing the problem...sorry i'm new at this!!
Reply With Quote
Reply


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 variable or With block variable not set haidee_mccaffrey Classic ASP Professional 5 March 8th, 2007 03:34 PM
"object variable or with block variable not set" netfresher ASP.NET 1.0 and 1.1 Basics 1 June 12th, 2006 03:50 PM
Object variable or With block variable not set tparrish VB Databases Basics 1 May 25th, 2005 10:25 AM
Object variable or With block variable not set tparrish VS.NET 2002/2003 3 May 22nd, 2005 07:40 AM



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


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