Results 1 to 6 of 6

Thread: DATAGRID / DATAENVIRONMENT

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153
    I have a datagrid that's connected to a COMMAND. What I would like to do is change part of the sql statement at run-time. Currently the "where name " is hard coded. I want the "where name =" to be whatever name is displayed in combo1.text. At run-time, all i need is to change my combo1.text and it updates the command for my data grid. I don't have a clue. So, if there's a solution out there, i'm pretty much going to need an example.

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    something like?

    strSQL= "select * from table where name='" & trim(combo1.text) & "'"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153
    I'm sorry, I was a little vague on my previous post. The COMMAND is SQL Comand inside of a Data Environment. Again, I would like the name(LFDIV) to be equal to combo1.text. Here's the current code within the SQL Command:

    SELECT Name, Account, Qtr1
    FROM Act
    WHERE (Name = 'lfdiv') AND (Account = 'ret_prem_g' OR
    Account = 'nii_gaap_inya' OR
    Account = 'reclass_rcg' OR
    Account = 'tot_revenue' OR
    Account = 'tot_benefit' OR
    Account = 'tot_inc_fpb' OR
    Account = 'tot_acq_exp' OR
    Account = 'opex_gaap_inya' OR
    Account = 'tot_deduct' OR
    Account = 'life_gaap_opinc' OR
    Account = 'tot_rcg_bef_taxmi' OR
    Account = 'life_net_inc')

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Just use the Filter method.
    Code:
    SQL.Filter="name='" & trim(combo1.text) & "'"

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153
    ED,

    I'm not sure how to use the code in my SQL Command code stated above. I tried pasting where the name is reference, but didn't work. An example would be very helpful. THANKS

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Code:
    Private Sub DataCombo1_Click(Area as integer)
    'Makes sure the click is in the dropdown box and there is something selected   
    If Area=2 And DataCombo1.text<>"" then 
       'Assuming the name of the DataEnvironment is de and the command is SQL and field is Where_Name
          de.SQL.Filter="Where_Name='" & DataCombo1.text & "'"
          'This filters through the recordset and pulls out any records that match the criteria in the filter
    End if
    End Sub
    Is that a little more clear? If not then feel free to tell me or email me.

    [Edited by Edneeis on 06-01-2000 at 06:19 AM]

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