Solved

Problem with MS DataGrid ActiveX Control (V6 - SP3)

Posted on 2004-08-16
5
184 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now