Index: pgadmin/frm/frmEditGrid.cpp
===================================================================
--- pgadmin/frm/frmEditGrid.cpp	(revision 7976)
+++ pgadmin/frm/frmEditGrid.cpp	(working copy)
@@ -1219,12 +1219,7 @@
         SetLimit(templong);
     }
 
-    // Check we have access
-    if (connection->ExecuteScalar(wxT("SELECT count(*) FROM ") + tableName + wxT(" WHERE false")) == wxT(""))
-        return;
-
-    SetStatusText(_("Refreshing data, please wait."), 0);
-
+	// Disable the controls to prevent anything interfering with the query thread
     toolBar->EnableTool(MNU_REFRESH, false);
     viewMenu->Enable(MNU_REFRESH, false);
     toolBar->EnableTool(MNU_OPTIONS, false);
@@ -1235,7 +1230,25 @@
     toolsMenu->Enable(MNU_ASCSORT, false);
     toolsMenu->Enable(MNU_DESCSORT, false);
     toolsMenu->Enable(MNU_REMOVESORT, false);
+	
+    // Check we have access
+    if (connection->ExecuteScalar(wxT("SELECT count(*) FROM ") + tableName + wxT(" WHERE false")) == wxT(""))
+	{
+        toolBar->EnableTool(MNU_REFRESH, true);
+        viewMenu->Enable(MNU_REFRESH, true);
+        toolBar->EnableTool(MNU_OPTIONS, true);
+        toolsMenu->Enable(MNU_OPTIONS, true);
+        toolsMenu->Enable(MNU_INCLUDEFILTER, true);
+        toolsMenu->Enable(MNU_EXCLUDEFILTER, true);
+        toolsMenu->Enable(MNU_REMOVEFILTERS, true);
+        toolsMenu->Enable(MNU_ASCSORT, true);
+        toolsMenu->Enable(MNU_DESCSORT, true);
+        toolsMenu->Enable(MNU_REMOVESORT, true);
+        return;
+	}
 
+    SetStatusText(_("Refreshing data, please wait."), 0);
+
     // Stash the column sizes so we can reset them
     wxArrayInt colWidths;
     for (col = 0 ; col < sqlGrid->GetNumberCols() ; col++)
