I run the following code from a command button on a main form, "frmCallCentre".
Sometimes when running the code the main form doesn't reload and leaves me seeing the navigation pane even if I convert to a ACCDE, the form is in the startup "Display Form" area.
The form loads ok on startup and after Compact-Repair also.
Is there something in the code which stands out to you guys?
Code: Select all
Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stDocName4 As String
'Dim stDocName5 As String
Dim stDocName6 As String
Me.txtPaint = ""
Me.txtBody = ""
Me.txtMET = ""
Me.txtInNow = ""
Me.sbfDueIn.Form.RecordSource = ""
Me.sbfCCarOverDue.Form.RecordSource = ""
Me.sbfDueIn.SourceObject = "frmWait"
Me.sbfCCarOverDue.SourceObject = "frmBlank"
Me.Refresh
DoEvents
DoCmd.SetWarnings False
stDocName1 = "mkJCV"
stDocName2 = "mkDBA_VR_VEHICLES"
stDocName3 = "mkDBA_VR_HIREHISTORY"
stDocName4 = "mkDBA_vCourtesyAvailability"
'stDocName5 = "mkDBA_JOB_CONTROL_VIEW"
stDocName6 = "mkDBA_JOB_ADDITIONAL_REFS"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoCmd.OpenQuery stDocName4, acNormal, acEdit
'DoCmd.OpenQuery stDocName5, acNormal, acEdit
DoCmd.OpenQuery stDocName6, acNormal, acEdit
Me.sbfDueIn.Form.RecordSource = "qryDueIn"
Me.sbfCCarOverDue.Form.RecordSource = "qryCCarOverDue"
DoCmd.SetWarnings True
Me.sbfDueIn.Visible = True
Me.sbfCCarOverDue.Visible = True
Me.txtScrollDate = Date
Me.txtPaint = DSum("[Pai]", "qryDueIn", "[DueIn]=txtScrollDate")
Me.txtBody = DSum("[Bod]", "qryDueIn", "[DueIn]=txtScrollDate")
Me.txtMET = DSum("[MET]", "qryDueIn", "[DueIn]=txtScrollDate")
Me.txtInNow = DCount("[JobID]", "qryDueIn", "[OnSiteDateTime]<=txtScrollDate")
Me.Requery
Me.sbfDueIn.SourceObject = "sbfDueIn"
Me.sbfCCarOverDue.SourceObject = "sbfCCarOverDue"
Me.Visible = True