PDA

Click to See Complete Forum and Search --> : Data Environment


Hutty
Apr 16th, 2000, 07:47 PM
In a Data Environment Command sql statement I want to set the name to be retrieve to equal the combo1 text. Also, how would I refresh a datagrid in combo_click event? This what I have:

SELECT Name, Account, Qtr1
FROM Act
WHERE name = '" & Trim(frmDataEnv.Combo1.Text) & "' 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')

pardede
Apr 16th, 2000, 09:12 PM
Refreshing in ADO - DE requires rebinding your bound control. Do this:

Set Datagrid1.Datasource = Datagrid1.Datasource

As to your DEC - SQL, i believe you need to use parameters... unfortunately i haven't used it so i can't tell you how just yet...

Apr 16th, 2000, 10:55 PM
hi
first of all set up a dummy query in the dataEnvironment,
then overwrite it using the code below.

dataEnvironmet1.Commands("Command_Name").CommandText = "select ... where xyz = form1.txtName"

Hutty
Apr 17th, 2000, 03:26 AM
I tried playing with the suggested code, but to no avail. Not sure how to go about inserting the code. In the Data Environment code module I inserted the following code:


Private Sub rsCommand2_WillChangeField(ByVal cFields As Long, ByVal Fields As Variant, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
dataEnvironmet2.Commands("Command2").CommandText = "SELECT Name, Account, Qtr1 From Act WHERE name = '" & Trim(frmDataEnv.Combo1.Text) & "' AND Account = 'ret_prem_g' OR account = 'nii_gaap_inya' OR Account = 'reclass_rcg' OR Account = 'tot_revenue' OR Account = 'tot_benefit'"

End Sub

If I went about it the right way, I'm getting the error message "proceduce declaration doesn't match description of event"