Solved

Problem with MS DataGrid ActiveX Control (V6 - SP3)

Posted on 2004-08-16
5
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

687 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