Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. unloading a form at load time

unloading a form at load time

Scheduled Pinned Locked Moved Visual Basic
helpdatabasequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcm
    wrote on last edited by
    #1

    Dim checkSQL As String checkSQL = "SELECT OrderGenerate.OrderNumber, Client.Company, OrderGenerate.Completed " & _ " FROM Client INNER JOIN OrderGenerate ON Client.ClientCode = OrderGenerate.ClientCode " & _ " WHERE OrderGenerate.OrderDate= #" & dDate & "#" Set RS = Conn.Execute(checkSQL) If RS.BOF And RS.EOF Then MsgBox "No orders yet today", vbExclamation, "No records returned" Unload Me Exit Sub End If The above is code that is located at the form load of the form. if no records are returned from the SQL statement, i wish the message box to be displayed and the form to be unloaded, however on run time, it crashes "object was unloaded" - is there anything i can do to fix this? any help would be greatly appreciated!

    H 1 Reply Last reply
    0
    • M mcm

      Dim checkSQL As String checkSQL = "SELECT OrderGenerate.OrderNumber, Client.Company, OrderGenerate.Completed " & _ " FROM Client INNER JOIN OrderGenerate ON Client.ClientCode = OrderGenerate.ClientCode " & _ " WHERE OrderGenerate.OrderDate= #" & dDate & "#" Set RS = Conn.Execute(checkSQL) If RS.BOF And RS.EOF Then MsgBox "No orders yet today", vbExclamation, "No records returned" Unload Me Exit Sub End If The above is code that is located at the form load of the form. if no records are returned from the SQL statement, i wish the message box to be displayed and the form to be unloaded, however on run time, it crashes "object was unloaded" - is there anything i can do to fix this? any help would be greatly appreciated!

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      try this and let me know :) If RS.BOF And RS.EOF Then MsgBox "No orders yet today", vbExclamation, "No records returned" Conn.Close rs.Close Set Conn=Nothing Set rs=Nothing Unload Me Exit Sub End If

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups