Form :: performance hit from control conditions?

J

jason

I need urgent advice with regards a FORM that has a number of afterupdates
and form events happening with regards conditional display of certain
fields and their values depending on what a user selects in various combo
boxes on the forms.

PROBLEM: I am finding that when you attempt to scroll to the next record
there is a serious delay and you actually have to click the scroll button
twice to get to the next or new record or vice versa.

I am stumped as to how to overcome this problem. Here is my code - perhaps
someone can tell me if any of my sub procedures need to be redeveloped or I
need to tackel my situation in a different way?

Much appreciated
Jason

Dim bWasNewRecord As Boolean

Private Sub Form_AfterDelConfirm(Status As Integer)
Call AuditDelEnd("audTmpListings", "audListings", Status)
End Sub

Private Sub Form_AfterUpdate()
Call AuditEditEnd("tblListings", "audTmpListings", "audListings",
"ListingsID", Nz(Me!ListingsID, 0), bWasNewRecord)
Model.SetFocus
record_alert = "Administrator has UPDATED the following record " &
Model.Value
'//Call SendMessage(record_alert)
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
End Sub

Private Sub Form_Current()
Call Status_Price_Reduced_AfterUpdate
Call Status_AfterUpdate
End Sub





Private Sub Form_Delete(Cancel As Integer)
Call AuditDelBegin("tblListings", "audTmpListings", "ListingsID",
Nz(Me.ListingsID, 0))
End Sub







Private Sub Status_Price_Reduced_AfterUpdate()
On Error GoTo Err_Handler
Dim bShow As Boolean

bShow = Me.Status_Price_Reduced.Value

If Me.Current_Price.Visible <> bShow Then
'//MsgBox (bShow)

Price_Reduction_frame.Visible = bShow
'//Current_Price.Visible = bShow

If bShow = False Then
With Me.Current_Price
.Value = Null
End With
End If
Current_Price.Visible = bShow

Price_Reduction_Date.Visible = bShow
End If

Exit_Handler:
Exit Sub

Err_Handler:
Select Case Err.Number
Case 2164, 2165 'Can't disable/hide the control with focus.
Me.[ListingID].SetFocus
Resume
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Resume Exit_Handler
End Select
End Sub



Private Sub Status_AfterUpdate()
On Error GoTo Err_Handler


Me.Status.SetFocus

If Me.Status.Text = "Sold" Then

Closing_Date.Visible = True
Closing_Details_Frame.Visible = True

Else
Closing_Date.Visible = False
Closing_Details_Frame.Visible = False

End If

If Me.Status.Text = "Vessel Under Offer" Then

Selling_Broker_VUO_ID.Visible = True

Selling_Broker_VUO_Question.Visible = True

Else

'Me.Selling_Broker_VUO_ID.Text = "None"

With Me.Selling_Broker_VUO_ID
.Value = Null
.Visible = False
End With
Me.Selling_Broker_VUO_ID.Visible = False
Me.Selling_Broker_VUO_Question.Visible = False


End If

Exit_Handler:
Exit Sub

Err_Handler:
Select Case Err.Number
Case 2164, 2165 'Can't disable/hide the control with focus.
Me.[ListingID].SetFocus
Resume
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Resume Exit_Handler
End Select
End Sub



Private Sub Year_BeforeUpdate(Cancel As Integer)
If Len(Me.Year) <> 4 Then
MsgBox "You must enter a four-digit year.", vbInformation,
"Enter 4-Digit Year"
Cancel = True
End If
End Sub
 
T

Tony Toews

jason said:
I need urgent advice with regards a FORM that has a number of afterupdates
and form events happening with regards conditional display of certain
fields and their values depending on what a user selects in various combo
boxes on the forms.

PROBLEM: I am finding that when you attempt to scroll to the next record
there is a serious delay and you actually have to click the scroll button
twice to get to the next or new record or vice versa.

I am stumped as to how to overcome this problem. Here is my code - perhaps
someone can tell me if any of my sub procedures need to be redeveloped or I
need to tackel my situation in a different way?

Your code looks pretty simple. Making fields visible or not doesn't
take long.
Call AuditDelEnd("audTmpListings", "audListings", Status)

Could you post the code for the above routine?

I've had similar calculating problems when doing sums of fields on
subforms and passing the values to a main form. Are you doing such?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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