Form open and continue issue

soccerkingpilot

New member
Local time
Today, 15:39
Joined
Jun 8, 2012
Messages
9
I have a macro that calls a form to open when an email address isn't found on file for a particualr person. The macro needs to pause as the form opens to allow the user to put in the email address and then resume once they close the form.

I have a couple of problems. If the form isn't in acDialog mode, the macro won't pause until the form is closed. If I put the form in acDialog mode, though, it locks all data from being changed.

Does anyone know how to write this better so that I can open the form, let the user put in data, then close the form and resume the macro?

Here is the macro call:
Code:
Sub Email_Check(cur_rec)
    Dim rt As DAO.Recordset
    Set rt = CurrentDb.OpenRecordset("SELECT * FROM SUPERVISORS")
    eResponse = DCount("SUPV_EMAIL", "SUPERVISORS", "[SUPV_EMAIL]='" & cur_rec & "'")
    If eResponse = 0 Then
        rt.Edit
        DoCmd.OpenForm "New_Supv_Email", acNormal, , "[SUPV_NAME] = '" & cur_rec & "'", , acDialog
        rt.Update
    End If
    MsgBox ("done")
End Sub

Here is the code for the form. Clicking submit just closes the form since it saves as the data is entered, skip will erase the text field and close the form.
Code:
Private Sub sup_email_skip_Click()
    Me.Text10 = ""
    DoCmd.Close acForm, "New_Supv_Email", acSaveNo
End Sub
Private Sub sup_email_submit_Click()
    DoCmd.Close acForm, "New_Supv_Email", acSaveNo
End Sub
 
Dim Public variable(s)
Set values for this variables in the popup form.
Update after you close the pop up form:

Pseudocode:
Code:
Public Var1,Var2, ....
Sub .....
  ........
   rt.Edit
     DoCmd.OpenForm ...... , acDialog 'Assign values to Var1, Var2, ....
     rt!Field1 = Var1
     rt!Field2 = Var2
     .....
   rt.Update
  .......
End Sub
 

Users who are viewing this thread

Back
Top Bottom