Hi,
I have an annoying problem with Access 2003 using its form_current
procedure. Within the procedure I am calling a function which updates a
listbox (see code below). However, when I open the form it appears to be
continually 'refreshing' the whole form for 5-6 seconds before stopping. I
have tried this on two PCs and the same problem occurs. This should be
really simple, I have tried removing the event and putting a button on the
form to execute the procedure and that works perfectly, however I really do
need it to be on_current!
Any Ideas?
------------------------
Private Sub Form_Current()
Call UpdateObjects
End Sub
Sub UpdateObjects()
Dim strSQL As String
strSQL = "SELECT [Tbl Objects].ObjectID, [Tbl Objects].ProjectID, [Tbl
Objects].ObjectName, "
strSQL = strSQL & "[Tbl Object Types].ObjectType, [Tbl
Objects].ObjectDateCreated, [Tbl Objects].ObjectLastModified "
strSQL = strSQL & "FROM [Tbl Object Types] INNER JOIN [Tbl Objects] ON [Tbl
Object Types].TypeID = [Tbl Objects].Object_Type "
strSQL = strSQL & "WHERE ((([Tbl Objects].ProjectID)=" & Me.ProjectID & ")
AND (([Tbl Object Types].TypeID)=" & Me.CboObjectType.Value & "));"
Me.lstObjects.RowSource = strSQL
Me.Requery
End Sub
----------------------
TIA
Sarah
MacDermott - 30 Jan 2005 12:13 GMT
Instead of requerying the form, just requery the listbox.
Requerying the form causes the Form_Current event to fire again.
It's a mercy it stops at all!
> Hi,
>
[quoted text clipped - 37 lines]
>
> Sarah
Marshall Barton - 30 Jan 2005 15:54 GMT
>I have an annoying problem with Access 2003 using its form_current
>procedure. Within the procedure I am calling a function which updates a
[quoted text clipped - 26 lines]
>
>End Sub
McDermott put his finger on the problem, but you do not even
need to requery the list box. Setting the RowSource
property will automatically force a requery, so just get rid
of the requery altogether.

Signature
Marsh
MVP [MS Access]