Quantcast
Channel: Dynamics User Group
Viewing all articles
Browse latest Browse all 15740

Check boxes and conditional code execution.

$
0
0

Hi Guys,

I have an interesting problem whereby I need to execute two different bits of code depending of whether or not a Check box is ticked.

The form is set up with several Control buttons on it which allow users to import, preview and export data. This all has been working great but now we have new files to process depending on their point of origin. Hence the need to use a check box to determine which import file and consequently which code to run. I have this so far but am uncertain if it is the best way to approach this. Any ideas?

Many thanks,

H

 

Code: N.B. the UCITS_FILE_EXPORT is the checkbox and variable name.
 IF

 UCITS_FILE_EXPORT = "YES"
 THEN

 OpenMethod := 2; // 1=adOpenKeyset; 2=adOpenDynamic; 3= adOpenStatic
 LockMethod := 3; // 1=dLockreadonly; 2=adLockPessimistic; 3=adLockOptimistic; 4=adLockBatchOptimistic
 CREATE(ADOConn);

// build connection string...

 ConnStr := 'Driver={SQL Server};Server=ServerABC;Database=TESTNAV;Trusted_Connection=yes';

// now connect to sqlserver database...

 ADOConn.Open(ConnStr);
                    
// build sql string...
 

  SQLstring := STRSUBSTNO('EXEC msdb..sp_start_job ''BuildUCITSDailyPrices''');


// run the SSIS job to export our file
  
   ADOConn.Execute(SQLstring);

// disconnect from database...

 ADOConn.Close;

// clear connection...

 CLEAR(ADOConn);

ELSE


Viewing all articles
Browse latest Browse all 15740

Trending Articles