'Calculating' regularly....

A

Al

Hi,
I've got the following code which I've cribbed together as a result of post
searching for similar problems/requirements etc..
However, I quite regularly get 'Calculating' problems when entering into a
record. Can anyone suggest any of the following (I've only included relevant
code) that could be causing this?

My thoughts are that it could be the reporting code on Form_Load (at the
bottom). This basically looks for all repors and populates a drop-down box.
If so, would it be possible to change it that this only works when I
physically select the combo box for the reports, e.g. create a new entry and
put this code within Private Sub lstReports_Click()??

Private Sub Form_Current()
ContractNoExpiration_AfterUpdate
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
DateCreated = Now()
Status = "Pending"
Else
End If
End Sub

Private Sub Form_Load()
Dim strList As String
Dim rpt As AccessObject
Dim rpts As Object

Set rpts = CurrentProject.AllReports

For Each rpt In rpts
If rpt.Name Like "rptCon*" Then
strList = Mid(rpt.Name, 4) & ";" & ReportDescription(rpt.Name) & ";"
& strList
End If
Next

Me.lstReports.RowSourceType = "Value List"
Me.lstReports.RowSource = strList

End Sub

Thanks for any suggestions on this. Al.
 
J

John Smith

If you replace your value list for lstReports with a query such as:

SELECT Name, Mid$(Name, 7) FROM MSysObjects
WHERE Type = -32764 AND Left$(Name, 6) = "rptCon"
ORDER BY Mid$(Name, 7)

it should be quicker than processing a collection, but I would doubt that this
is the cause of your slowness as it only runs once at form load. Form current
runs each time that you move to a new record so I would suggest that you look
at whatever ContractNoExpiration_AfterUpdate is doing for the cause of the delay.

HTH
John
##################################
Don't Print - Save trees
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top