Results 1 to 4 of 4

Thread: SQL query inconsistent with DBGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    10

    SQL query inconsistent with DBGrid

    Hi,

    I have a DBGrid in my code that I was trying to replace with an MSFlexGrid. I have the following code:

    Dim SqlStr As String

    SqlStr = ""
    If TB_DataEntry(BrickDataID) <> "" Then
    SqlStr = "Select * from QBrickComboStockShapeGroupType WHERE (BrickDataID=" & TB_DataEntry(BrickDataID) & ") Order By TBrickShape.BrickShapeID;"
    DataCurrent.RecordSource = SqlStr
    DataCurrent.Refresh
    '
    ' columns translations
    '
    dbActualGrid.Columns(0).Caption = TRNS_STANDARD
    dbActualGrid.Columns(1).Caption = TRNS_SHAPE
    dbActualGrid.Columns(2).Caption = TRNS_KEY
    dbActualGrid.Columns(3).Caption = TRNS_SLASHRING
    dbActualGrid.Columns(4).Caption = TRNS_SLASHSECTION
    dbActualGrid.Columns(5).Caption = TRNS_BRICKS
    dbActualGrid.Columns(6).Caption = TRNS_WEIGHTSPACETONNES
    '

    dbActualGrid.Refresh
    End If

    Too late I learnt that MSFlexGrid is read-only and would not be able to allow the user to delete records from it. I hope I understood that correctly.

    Now however when I try to return to the old code with DBGrid, I do not get the same output on the grid. Instead of getting just the columns that I wanted to be displayed (the 7 columns that you see in the code), I get all the columns of the Access database Query.

    Does anyone know why this would happen? It is the exact same code as before I did the swap.

    Thanks

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    At a gues the original dbgrid was bound and you assigned all the columns... and now its not.


    Select * from table <--- returns all fields.
    Select field1,field2,field3 from table <---- returns only entered fields


    As to the flexgrid being readonly - I thought it had data manipulation on it, unless someone suggested it because its easier to display things in colour... or summat. Perhaps they were trying to get you to unbind your controls??


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    10

    Is there a DAO VB6 replacement for DBGrid?

    Hi,

    Thanks for the info. I was able to find all the fields except for the Key field. So except for that, I display all the fields in the dbgrid.

    The reason why the change to msflexgrid is because management does not want to keep any VB5 controls. And unfortunately the code is still DAO. So I cannot use the DataGrid control. I was actually wondering if there is a control I can use that is DAO but mimics the functionality of the DBGrid.

    Thanks again

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Thought the DBGrid was Dao - depending which version of data controls you had??


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width