Solved

Problem with MS DataGrid ActiveX Control (V6 - SP3)

Posted on 2004-08-16
5
186 Views
Last Modified: 2013-12-25
Hello,

Im currently using this control to read tables from a database and allow the user to update them. Table values are loaded into this control based on the option selected in the Select Table menu. So if a user selects Table A from the the Menu, the values of Table A are loaded from the database.

However, Ive noticed that I cannot seem to display additional columns for other tables I dispaly. For example, in design mode I have set the DataMember property of this control to "Table A" So only the columns in this table will appear. (say 2 columns). But when I change it through my code to a different table (depending upon the option that the user has selected - Example Table B) only the first two rows of table B appear not the third one. But ive noticed that if i set this to a default in design mode and click on the "Retrieve Fields" property of the datagrid control, all three columns appear hasslefree. Is there a way to run this "retrieve fields" property dynamically through my code.

Heres my code:

Private Sub mnuSelectTable_Click(index As Integer)
    ' Structure to set data grid to selected table
    Select Case index
    Case 0
        dtgTable.DataMember = "tblA" 'has 2 columns, also this table is already set, in design mode, to appear as default
    Case 1
        dtgTable.DataMember = "tblB" 'has 3 columns, but only the first two show up...
    Case 2
        dtgTable.DataMember = "tblC"
    '...etc
    End Select
End Sub    

I'll appreciate if somecan please help me with this. I cannot use otehr controls as I am fixing someone elses code so that would require restructing his code/application.

RS
0
Comment
Question by:rsajoo
5 Comments
 
LVL 5

Expert Comment

by:brianb99999
ID: 11815701
I think from memory you have to perform a refresh or requery after you have set the datamember,
something like dtgtable.refresh or dtgtable.requery

Brian.
0
 

Author Comment

by:rsajoo
ID: 11822123
Its ok Ive fixed it by removing the default table that the control is linked to (in design view). However, I have another question, is there a way to change the dataformat of a column (ie for boolean datafields we want checkboxes) from my code? Ive tryed the following but both do not seem to work. Is there a work around?

mygrid.colums(2).dataformat = "boolean"
and
mygrid.colums(2).dataformat = 8

Please let meknow

RS
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12942307
PAQed with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

832 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