Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    29

    Unanswered: Invalid Use of Null in VBScript

    I have the following code but I am getting the following error
    Invalid use of Null I am getting this error in this field SHIP_TO_ADDR_NO becuase it has no value.

    Code:
    OrderNo = InputBox("Please Enter/Scan Order number #:"  , "Order Number")
    
    'If OrderNo is blank.
    If OrderNo = "" then
    	WScript.Quit
    End if
    
    Dim Id
    Dim Cust_id
    Dim Cust_po_ref
    Dim Email
    Dim SHIP_TO_ADDR_NO
    
    ' DSN to Access file
    sConnectionString = "DSN=Visual_MFG"
    
    Set command = WScript.CreateObject("ADODB.Command")
    command.ActiveConnection = sConnectionString
    
    'Look into the Order table to find the Customer ID
    command.CommandText = "SELECT CUSTOMER_ORDER.ID,CUSTOMER_ORDER.CUSTOMER_ID, CUSTOMER_ORDER.CUSTOMER_PO_REF, CUSTOMER_ORDER.SHIP_TO_ADDR_NO, CUSTOMER_ORDER.CONTACT_EMAIL FROM customer_order WHERE CUSTOMER_ORDER.ID ='" & OrderNo & "'"
    Set recordset = command.Execute()
    
    If recordset.EOF Or recordset.BOF Then
    		MsgBox "No records found!"
    		WScript.Quit
    Else
    	ID = Trim(recordset.fields("ID"))
    	CUST_ID = Trim(recordset.fields("CUSTOMER_ID"))
    	CUST_PO_REF = Trim(recordset.fields("CUSTOMER_PO_REF")) 
    	SHIP_TO_ADDR_NO = Trim(recordset.fields("SHIP_TO_ADDR_NO"))
    	Email = Trim(recordset.fields("CONTACT_EMAIL"))
    End if
    Any help would be great Thank You!
    Last edited by loquin; 04-07-06 at 12:55. Reason: add code tags. ([code] [/code])

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Code:
    SHIP_TO_ADDR_NO = Trim(recordset.fields("SHIP_TO_ADDR_NO")) & ""
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Mar 2004
    Posts
    29
    Thank you!

Posting Permissions

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