pause code to wait for other routine to finish

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have a database where when the main form opens I want it to check a query
that was created on db load and if any records were met open a form showing
these records and then allow a letter to be printed for each record. Once
this has been completed the routine would then continue to check another
query and then finally load the form.

Have tried the following code but obviously missing some concept on how to
accomplish this, as when the user prints a report as part of the
frm_writeoff the code on the main form continues.

Private Sub Form_Open(Cancel As Integer)
Dim rec As Recordset
Form_Switchboard.Visible = False
Set rec = Me.RecordsetClone

'if records then user has to address records that have expired print off
letters and then continue

If DCount("*", "[qExpiryDate]") > 0 Then
Me.Visible = False
DoCmd.openform "frm_writeoff", , , , , acDialog
End If

If DCount("*", "[qExpiryDateWOPending]") > 0 Then
DoCmd.openform ("frm_writeoffpending")
End If

rec.MoveLast 'open form at last record
Me.Bookmark = rec.Bookmark
rec.Close
DoCmd.Maximize

End Sub

How do I stop code so I can do a bunch of other things and then go back to
it. Appreciate some quidance.
Chris
 
Put STOP as the first line.

Then use F8 to walk through the code.

I recommend a good book that covers debugging.




Chris
 
Back
Top