Hi TC,
Thanks for the info and thanks for your help! But I figured it out
<g>.
For a couple of passes through the table, I needed it sorted and
filtered so I opened the recordset with a query, for example,
Set dbs = CurrentDb
StrCriteria = "SELECT * From Services where
(services.SourceFile='Residential' and Services.Dept_Provider = 13 and
Services.InsType = '10' and (Services.ProcCode = 'W1044' or
Services.ProcCode = 'W1046' or Services.ProcCode = 'H2014' or
Services.ProcCode = 'H2017')) order by ServDate, MIS;"
Set rs = dbs.OpenRecordset(StrCriteria)
However, the monster pass through the table required no such filters
or sorting. So instead of opening with a query, I simply opened the
table:
Set dbs = CurrentDb
' StrCriteria = "SELECT * From Services;"
' Set rs = dbs.OpenRecordset(StrCriteria)
Set rs = dbs.OpenRecordset("Services", dbOpenTable)
VOILA: No more bloat!
Now, can you enlighten as to why there's so much more activity with a
recordset opened via query vs a straightforward opening of the table?
Again, it balloons from a 40 mb mdb to over 500 mb just after this one
pass through one table. I'm not doing any adds or deletes, but LOTS
of edits. At the very end is the code, fwiw.
Thanks again for all your help!
-Steve Lord
TC said:
It depends on how you are changing the table. Repeated additions, edits &
deletions will eventually cause database bloat: this is inevitable. It is
not really related to the locking strategy, so that won't help you. The db
size won't go back down until you compact the database. (You >are<
compacting it, yes?)
In my experience, repeated edits, deletions & general shuffling-arounds are
often not required in a properly designed relational database. For example,
people might archive records my moving them off into an archive table; but
you could achieve the same result, with less bloat, by setting an "archive"
flag in the relevant records.
Perhaps give some (simple) examples of how you are changing the data.
HTH,
TC
CODE:
Public Sub OutpatientServices()
Dim dbs As Database
Dim rs As Recordset
Dim StrCriteria As String
' Open a recordset of Services to process the records
Set dbs = CurrentDb
' StrCriteria = "SELECT * From Services;"
' Set rs = dbs.OpenRecordset(StrCriteria)
Set rs = dbs.OpenRecordset("Services", dbOpenTable)
' Loop through the recordset and set HCPC values for the Outpatient
services
rs.MoveFirst ' start with the first record
Do Until rs.EOF
rs.Edit
'---- MEDICAL OUTPATIENT AND OUTPATIENT SERVICES ---- regardless of
SourceFile
If rs!Prov_Type = 8 Or rs!Prov_Type = 9 Then ' ARNP/MD Staff
'Psych Evals
If rs!ProcCode = "90801" Or rs!ProcCode = "W1030" Or _
(rs!ProcCode = "H2010" And (rs!Modifier = "HP" Or
rs!Modifier = "HO")) Then
rs!HCPC = "H2010"
If rs!Prov_Type = 9 Then ' MD
rs!Mod1 = "HP"
ElseIf rs!Prov_Type = 8 Then ' ARNP
rs!Mod1 = "HO"
End If
rs!ElapsedTime = 60
'Med Checks - include No Mod, with both 2 units and 1 unit
with a StartTime
ElseIf rs!ProcCode = "W1050" Or rs!ProcCode = "90862" Or _
(rs!ProcCode = "H2010" And rs!Units = 2 And
(IsNull(rs!Modifier) = True)) Or _
(rs!ProcCode = "H2010" And rs!Units = 1 And
(IsNull(rs!Modifier) = True) And (IsNull(rs!starttime) = False)) Then
rs!HCPC = "H2010"
rs!Mod1 = Null
rs!ElapsedTime = 15
' Miscellaneous or errant codes for medical staff - Recoded as
Med Checks
ElseIf rs!ProcCode = "90802" Or rs!ProcCode = "90804" Or _
rs!ProcCode = "90805" Or rs!ProcCode = "90806" Or _
rs!ProcCode = "90807" Or rs!ProcCode = "90845" Or _
rs!ProcCode = "90853" Or rs!ProcCode = "90857" Or _
rs!ProcCode = "90889" Or rs!ProcCode = "96100" Or _
rs!ProcCode = "99221" Or rs!ProcCode = "99242" Or _
rs!ProcCode = "99371" Or _
rs!ProcCode = "W1027" Or rs!ProcCode = "W1032" Or _
rs!ProcCode = "W1033" Or rs!ProcCode = "W1035" Or _
rs!ProcCode = "W1037" Or rs!ProcCode = "W1038" Or _
rs!ProcCode = "W1044" Or rs!ProcCode = "W1049" Or _
rs!ProcCode = "W1059" Or rs!ProcCode = "W1070" Or _
rs!ProcCode = "W1073" Or rs!ProcCode = "W1074" Or _
rs!ProcCode = "W1075" Or _
rs!ProcCode = "H0002" Or rs!ProcCode = "H0004" Or _
rs!ProcCode = "H0031" Or rs!ProcCode = "H0046" Or _
rs!ProcCode = "H2010" And rs!Modifier = "HM" Or _
rs!ProcCode = "H2010" And rs!Modifier = "HE" Then
rs!HCPC = "H2010"
rs!Mod1 = Null
rs!ElapsedTime = 15
End If
rs!CostCenter = "12" ' Set Cost Center to 12 for Medical Staff
ElseIf rs!Prov_Type = 7 Then ' NURSING Staff
' Office and Outpatient Visit
If rs!ProcCode = "W1038" Or rs!ProcCode = "H0002" Then
rs!HCPC = "H0002"
rs!Mod1 = Null
rs!CostCenter = "12"
' Erroneous Nursing Service coded as Clinic Visit
ElseIf rs!ProcCode = "W1030" Or _
rs!ProcCode = "W1035" Or _
rs!ProcCode = "W1050" Or _
rs!ProcCode = "90862" Then
rs!HCPC = "H0046"
rs!Mod1 = "HE"
rs!CostCenter = "12"
' Outpatient - Open Clinic -- Treat as COST CENTER 14
ElseIf (rs!ProcCode = "H0004" And rs!Modifier <> "HQ") Or _
rs!ProcCode = "W1074" Then
rs!HCPC = "H0004"
rs!Mod1 = Null
rs!CostCenter = "14"
End If
ElseIf rs!Prov_Type = 14 Or rs!Prov_Type < 7 Then ' Clinical
Staff
rs!test = "Provider " & rs!Prov_Type
' Individual Therapy
If rs!ProcCode = "90806" Or rs!ProcCode = "90808" Or _
rs!ProcCode = "W1074" Or _
(rs!ProcCode = "H0004" And (rs!Modifier <> "HQ" Or
IsNull(rs!Modifier = True))) Then
rs!HCPC = "H0004"
rs!Mod1 = Null
rs!CostCenter = "14"
' Psychological Testing
ElseIf rs!ProcCode = "96100" Or _
(rs!ProcCode = "H0031" And (IsNull(rs!Modifier) = True))
Then
rs!HCPC = "H0031"
rs!Mod1 = Null
rs!CostCenter = "14"
' BioPsychosocial Exam
ElseIf rs!ProcCode = "W1027" Or _
(rs!ProcCode = "H0031" And rs!Modifier = "HN") Then
rs!HCPC = "H0031"
rs!Mod1 = "HN"
rs!CostCenter = "14"
' Office and Outpatient Visit - probably errors
ElseIf rs!ProcCode = "W1038" Or rs!ProcCode = "H0002" Then
rs!HCPC = "H0002"
rs!Mod1 = Null
rs!CostCenter = "14"
' Erroneous coding billed as therapy
ElseIf rs!ProcCode = "80019" Or rs!ProcCode = "90801" Or _
rs!ProcCode = "90804" Or rs!ProcCode = "90805" Or
rs!ProcCode = "90807" Or _
rs!ProcCode = "90812" Or rs!ProcCode = "90819" Or _
rs!ProcCode = "90862" Or rs!ProcCode = "99371" Or _
rs!ProcCode = "W1030" Or rs!ProcCode = "W1033" Or _
rs!ProcCode = "W1034" Or rs!ProcCode = "W1050" Or _
rs!ProcCode = "W1064" Or rs!ProcCode = "W1070" Or _
rs!ProcCode = "W1071" Then
rs!HCPC = "H0004"
rs!Mod1 = Null
rs!ElapsedTime = 45
rs!CostCenter = "14"
End If
End If
' ------ End of MEDICAL OUTPATIENT AND OUTPATIENT SERVICES
rs.Update
rs.MoveNext
Loop
rs.Close
MsgBox ("Completed Processing of Outpatient Services")
End Sub