Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Beginning VB.NET Databases
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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!!


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.