PDA

Click to See Complete Forum and Search --> : Organinizing App


Hutty
Jan 10th, 2000, 12:02 AM
That what I would like to do, but I'm a Newbee. The above code is a part of a module(with corresponding form) that returns a value for 30 recordsets. I have several modules(8) for different forms. Everything is mainly at a Parent level. It's at the subname level where all the scenarios come into play because I need the names(30) to change in the SQL statement based on the criteria. Ex: "If combo1.text = "LFDIV_AN" THEN " the names in SQL statements would change. Complex?

Hutty
Jan 10th, 2000, 11:31 AM
I've run into a situation where my App. requires different scenarios based on the results of a combo box. There could be 45 different scenarios based on the combo box text. This may cause the creation of 45 different sub or function, maybe a different modules(.bas) for each. Forms as well.

Should I use resource files, the case statement, search and replace, etc.? A sample code is below. The names (AIGUS, ALICO, AIA) have about 10 -13 subnames that I may want the values for depending on the name in my combo box 1. The subnames will have suffixes suchas: AIGUS_AN, ALICO_AN AND AIA.AN.

Any ideas on how to tackle this?

ssql = "select * from Act where name = 'AIGUS'and account = '" & Trim(frmDataEnv.Combo3.Text) & "'"
Set myrecordset1 = frmDataEnv.myconnection.Execute(ssql)
ssql = "select * from Act where name = 'ALICO'and account = '" & Trim(frmDataEnv.Combo3.Text) & "'"
Set myRecordset2 = frmDataEnv.myconnection.Execute(ssql)
ssql = "select * from Act where name = 'AIA'and account = '" & Trim(frmDataEnv.Combo3.Text) & "'"
Set myRecordset3 = frmDataEnv.myconnection.Execute(ssql)
AddZeroValue myrecordset1, Premium.List2
AddZeroValue myRecordset2, Premium.List3
AddZeroValue myRecordset3, Premium.List4

Clunietp
Jan 10th, 2000, 11:35 AM
Can't you write 1 function that takes the parameters in combo box 1 and returns the desired result?