Results 1 to 2 of 2

Thread: Please help with DBGrid

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Please help with DBGrid

    I've got an very irritating problem with DBgrid. Any help or advise will be highly appreciated

    When opening form data loads into grid with other fields on form as well
    Form looks like this


    DBgrid: (only some colums as example)

    Code: Description: Qty: Weight: AirCraft Type

    A80 Magnesium Hydrate 2 3Kg FORBIDDEN
    A5 Battery Acid 10 1.5kg Passenger
    A78 Fire Extinguisher 1 .5kg Passenger
    A12 Lithuim Battery 2 .2kg Passenger

    Item 1 Forbidden on aircraft:

    Private Sub lblEdit_Click()
    'Forbidden item on Passenger and/or Cargo Aircraft
    If DBGrid1.Columns("Pass Cargo Pack Instr").Text = "FORBIDDEN" Then
    MsdgBox "Item is forbidden on Any Aircraft"
    Exit Sub
    End If
    Data3.UpdateRecord
    End Sub

    Private Sub lblPrint_Click()
    'Forbidden item on Passenger and/or Cargo Aircraft
    If DBGrid1.Columns("Pass Cargo Pack Instr").Text = "FORBIDDEN" Then
    MsdgBox "Item is forbidden on Any Aircraft - Canot Print Documentation"
    Exit Sub
    End If
    CrystalReport3.SelectionFormula = "{ControlHeadA.ControlNo} = " & txtControl.Text
    CrystalReport3.PrintReport
    End Sub

    Problem is that this works only when FORBIDDEN appears in the 1st row in the DBGrid

    When Forbidden appears after the first row it ignores the message and update the database and print the documentation

    A5 Battery Acid 10 1.5kg Passenger
    A78 Fire Extinguisher 1 .5kg Passenger
    A80 Magnesium Hydrate 2 3Kg FORBIDDEN
    A12 Lithuim Battery 2 .2kg Passenger

    How do I check for FORBIDDEN anywhere in the DBGrid column

    I need to sort grid by carton number and other criteria so sorting to get FORBIDDEN in the 1st row is not an option

  2. #2
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: Please help with DBGrid

    Quote Originally Posted by RayComp
    I need to sort grid by carton number and other criteria so sorting to get FORBIDDEN in the 1st row is not an option
    Data bound controls are notorioulsy inflexible. I would toss the datagrid, use a standard, non-bound grid, populate via an SQL query which you can sort (ORDER BY) anyway you want.
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

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