Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Problem with form_current

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S Marriott - 30 Jan 2005 11:04 GMT
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]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.