Solved

Problem with MS DataGrid ActiveX Control (V6 - SP3)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Word macro - how to get characters after the searched for string 5 68
using web browser with BING 40 110
TT Auto Dashboard 13 83
fso.FolderExists("\\server\HiddenFolder$") 4 51
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

911 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

22 Experts available now in Live!

Get 1:1 Help Now