Hi,
I'm reconstructing an access database having linked tables to Azure SQL Server.
One of the techniques I use is setting a recordsource only when needed. THis makes loading a page with tab-control much faster.
The following code shows part of the sub where the recordsource is set. The form is a bound subform so I need to set the master and childfields.
The following code works fine, but after each of the 3 lines the form is redrawn which makes is flashy and a bit slow (not too...).
Is it possible to pause repainting and doing these 3 commands at once?
The code:
Thanks!
I'm reconstructing an access database having linked tables to Azure SQL Server.
One of the techniques I use is setting a recordsource only when needed. THis makes loading a page with tab-control much faster.
The following code shows part of the sub where the recordsource is set. The form is a bound subform so I need to set the master and childfields.
The following code works fine, but after each of the 3 lines the form is redrawn which makes is flashy and a bit slow (not too...).
Is it possible to pause repainting and doing these 3 commands at once?
The code:
Code:
With Me.SFRNotes
SQL = "SELECT * FROM dbo_SQLView_Notes where dbo_sqlview_notes.projectid=" & Me.Id
If .Form.RecordSource <> SQL Then 'don't requery if query is already in place for this project
.Form.RecordSource = SQL '.Requery after this not necessary. Is done on changing recordsource
.LinkChildFields = "ProjectID" 'Linkfields must be set again because a change of recordsource
.LinkMasterFields = "ID" 'Resets them and Access sets them to 'Id' 'Id' or other wrong content
End If
End With
Thanks!