Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: 'Calculating' regularly....

Geek News

'Calculating' regularly....
Al 11/29/2008 1:08:01 PM
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.
Re: 'Calculating' regularly....
John Smith <johnDOTsmithATbromleyhospitalsDOTnhsDOTuk> 12/1/2008 3:36:06 PM
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

Al wrote:
[Quoted Text]
> 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.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net