Solved

How to kill empty columns!!

Posted on 1998-10-13
1
141 Views
Last Modified: 2010-04-30
My position is that I have a DBGRID with all sorts of columns and information in it.  

Lets say the DBGRID has an empty column, ie. no data in that column.

How do I figure this out (through code) and delete the column, or at least hide it?

Thanks.
0
Comment
Question by:MarkA
1 Comment
 
LVL 3

Accepted Solution

by:
vmano earned 200 total points
ID: 1439771
here is how:
this code finds you the contents of a cell in a DBGrid control

Dim igColumn As Integer
Dim igRow As Integer
Dim vargBookmark As Variant
 
      Private Sub DBGrid1_MouseUp(Button As Integer, Shift As Integer, _
                                  X As Single, Y As Single)
         igColumn = DBGrid1.ColContaining(X)   'Set the Cell Column number
         igRow = DBGrid1.RowContaining(Y)      'Set the Cell Row number
 
         vargBookmark = DBGrid1.RowBookmark(igRow) 'Set Bookmark Value
 
         'Show the contents of the cell in a textbox
         Text1.Text = DBGrid1.Columns(igColumn).CellValue(vargBookmark)

after you get the Text1.Text, set the CurrentCellVisible property of the DBGrid control.

let me know if this helps,
vmano
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question