code goes too fast

J

Jean-Paul

Hi,
Upon clicking a pushbutton this code runs:

DoCmd.GoToRecord , , acNewRec
Me!Naam.SetFocus
Dim ontvanger As String
Dim db As Database
Dim Tb As Recordset
Dim sql As String
Set db = CurrentDb()
sql = "SELECT Setup.* FROM Setup WHERE Setup.omschrijving='Database';"
Set Tb = db.OpenRecordset(sql)
ontvanger = Tb!Detail
SubjectBox = "Aanpassen database Sales met nieuwe input van " &
Forms!hoofdmenu!Tekst24
MessageBox = ""
DoCmd.SendObject acSendReport, "Fiche", acFormatHTML, ontvanger, ,
, [SubjectBox], [MessageBox], -1


the idea is to add a record and the send a mail to somebody where all
data is centralized.

Now, when I click the "add" button the code doesn't "wait" untill all
data is entered before the mail is send.

What to do?

Thanks
 
K

Ken Snell \(MVP\)

You need to separate your code into two procedures. Run one procedure to add
the new record (DoCmd.GoToRecord step). Run the other procedure to do the
emailing action. In other words, use two buttons, not one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top