PDA

Click to See Complete Forum and Search --> : Speed?


gerard
Aug 21st, 2000, 11:34 PM
Hi guys ...major problem I would like to question the community on!

I have a app that connects to a MS Access97 database. I believing I'm using ADO to do this. I have a form that has a tab control on it and the form is poulated with about 40 feilds. I have about 10 adodc controls that are hooked to 10 dbCombo boxes. I have a lot of validation occuring as the user moves from record to record. There only about 50 - 100 records been pulled back again using a ADODC control.

The problem is it takes about 3sec to move from record to record. I load all my combo boxes as the form loads therefor its not trying to load the combo boxes all the time. The validation is basically making certain controls and text boxes invisible depanding on the value in certain combo boxes. Is there a better stategy to speed things up?????


Regards


Gerard

Chuck Sweet
Aug 22nd, 2000, 07:16 AM
gerard,

I've got some ideas for you. try to subdivide your form into frames and separate the data according to what items are visible together. that way, you can just turn the frame invisible when you need to, vice versa.

also, you have 40 unique fields? ten combo boxes? sounds like a pretty big project. see if you can split some of that stuff up to more than one form. why don't you throw some code for one of your combo boxes out here so we can better see what the problem is?

chuck

gerard
Aug 22nd, 2000, 07:31 AM
Here is an example of code I use to populate my combo boxes

strInsertby = "SELECT * FROM [ListInsertedBy] Order by InsertedBy"


With AdInsertby 'ADODC control
.ConnectionString = cndata
.CommandType = adCmdText
.EOFAction = adDoMoveLast
.RecordSource = strInsertby
.Refresh
End With

I then set up the datasource and row source within the dbCombo control.

Gerard

Chuck Sweet
Aug 22nd, 2000, 08:09 AM
pay careful attention to how often you loop through your combo boxes for checks. are all the clicked events the same (for each combo box)? can you post some of that code too?

guess: you are checking each of the combo boxes to determine which element is selected and based on the states of all of the boxes, you determine which controls should be visible. are you checking which controls are already visible? if you are, don't bother. it will take you almost as much time to check them all as it would to go ahead and change them.

if you only load the dbcombos once, then your problem is not data access oriented. you are performing way too many checks. use boolean logic to cut down on this. ie. these three are the same.

1) Not optimal for our purposes:
if <condition1> or <condition2> and <condition3>
<do this>
elseif <condition1> or <condition2> and not <condition3>
<do this>
end if

2) Optimal if you only need to use the 'or' test once:
if <condition1> or <condition2>
if <condition3>
<do this>
else
<do this>
end if
end if

3) Optimal if you need to use the 'or' test more than once to avoid reevaluating the condition:
bTest = <condition1> or <condition2>
if btest and <condition3> then
<do this>
else
<do this>
end if

hopefully some of this will help. i mention the boolean thing because it's a mistake i make often and have to correct.

chuck