browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need Microsoft Access / VBA help?

Get answers from our community of Microsoft Access / VBA experts on BYTES! It's free.

dialog box

Member
 
Join Date: Jan 2007
Posts: 56
#1: Apr 5 '07
How do I get remove the dialog box that pops up each time a fax is getting ready to be sent. I just want them to go. Right now the user would have to click the yes each time.

I just want to have a message box show up that says you are about to seen 12 faxes do you want to send they click yes and 12 send with no dialog box if no the action cancels.

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rst As DAO.Recordset
  3. Dim strName As String
  4. Dim strFaxNo As String
  5. Dim strFax As String
  6.  
  7.  Set db = CurrentDb
  8.  
  9. strSQL = "SELECT TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep FROM tara INNER JOIN TProdInfo ON tara.ProdCd = TProdInfo.ProdCd GROUP BY TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep, tara.Email HAVING (((tara.Keep)=True) AND ((tara.Email)=fOSUserName()));"
  10.  
  11. Set rst = db.OpenRecordset(strSQL)
  12.  
  13. rst.MoveFirst
  14.  
  15. Do Until rst.EOF
  16. gProdCd = rst!ProdCd
  17. strName = "/Name=" & rst![Contact Name]
  18. strFaxNo = "/Fax=" & rst![Fax Number]
  19.  
  20. strFax = strName & strFaxNo & "/<fax@faxit.travp.net>"
  21.  
  22. DoCmd.SendObject acSendReport, "RPCDemandFax", acFormatRTF, strFax, , , "Outstanding Property Casualty Policies", "Please Review the Following Outstanding Policies", False
  23. rst.MoveNext
  24. Loop
  25. End Sub
  26.  



Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#2: Apr 5 '07

re: dialog box


I think this should work, I used the setwarnings command, this can be especially dangerous since you can delete everything in your db with no prompt if you do not return it to it's original state of true. You shouls add some error trapping in here and make sure if an error is trapped you set the setwarnings command = true in that area. Hope this helps.

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rst As DAO.Recordset
  3. Dim strName As String
  4. Dim strFaxNo As String
  5. Dim strFax As String
  6. Setwarnings = false
  7.  Set db = CurrentDb
  8.  
  9. strSQL = "SELECT TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep FROM tara INNER JOIN TProdInfo ON tara.ProdCd = TProdInfo.ProdCd GROUP BY TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep, tara.Email HAVING (((tara.Keep)=True) AND ((tara.Email)=fOSUserName()));"
  10.  
  11. Set rst = db.OpenRecordset(strSQL)
  12. 'To prevent an error when your recordset is empty use the following
  13. If not rst.eof then
  14. rst.MoveFirst
  15. YesNo =  MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo
  16. if YesNo = vbNo then exit sub
  17.  
  18. Do Until rst.EOF
  19. gProdCd = rst!ProdCd
  20. strName = "/Name=" & rst![Contact Name]
  21. strFaxNo = "/Fax=" & rst![Fax Number]
  22.  
  23. strFax = strName & strFaxNo & "/<fax@faxit.travp.net>"
  24.  
  25. DoCmd.SendObject acSendReport, "RPCDemandFax", acFormatRTF, strFax, , , "Outstanding Property Casualty Policies", "Please Review the Following Outstanding Policies", False
  26. rst.MoveNext
  27. Loop
  28. Setwarnings = true
  29. End Sub
  30.  
Member
 
Join Date: Jan 2007
Posts: 56
#3: Apr 5 '07

re: dialog box


Quote:

Originally Posted by Denburt

I think this should work, I used the setwarnings command, this can be especially dangerous since you can delete everything in your db with no prompt if you do not return it to it's original state of true. You shouls add some error trapping in here and make sure if an error is trapped you set the setwarnings command = true in that area. Hope this helps.

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rst As DAO.Recordset
  3. Dim strName As String
  4. Dim strFaxNo As String
  5. Dim strFax As String
  6. Setwarnings = false
  7.  Set db = CurrentDb
  8.  
  9. strSQL = "SELECT TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep FROM tara INNER JOIN TProdInfo ON tara.ProdCd = TProdInfo.ProdCd GROUP BY TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep, tara.Email HAVING (((tara.Keep)=True) AND ((tara.Email)=fOSUserName()));"
  10.  
  11. Set rst = db.OpenRecordset(strSQL)
  12. 'To prevent an error when your recordset is empty use the following
  13. If not rst.eof then
  14. rst.MoveFirst
  15. YesNo =  MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo
  16. if YesNo = vbNo then exit sub
  17.  
  18. Do Until rst.EOF
  19. gProdCd = rst!ProdCd
  20. strName = "/Name=" & rst![Contact Name]
  21. strFaxNo = "/Fax=" & rst![Fax Number]
  22.  
  23. strFax = strName & strFaxNo & "/<fax@faxit.travp.net>"
  24.  
  25. DoCmd.SendObject acSendReport, "RPCDemandFax", acFormatRTF, strFax, , , "Outstanding Property Casualty Policies", "Please Review the Following Outstanding Policies", False
  26. rst.MoveNext
  27. Loop
  28. Setwarnings = true
  29. End Sub
  30.  

this comes back with an sytanx error.

YesNo = MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo


Also when do i return it to it's original state when I caputure the error or at the end of the loop
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#4: Apr 5 '07

re: dialog box


Quote:

Originally Posted by favor08

this comes back with an sytanx error.

YesNo = MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo
Also when do i return it to it's original state when I caputure the error or at the end of the loop


Missed a parenthesis.
YesNo = MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo)

Expand|Select|Wrap|Line Numbers
  1. Public Sub Whatever()
  2. On error goto DumbErrorTrap
  3.  
  4. 'Do this and that
  5. loop
  6. setwarnings = true
  7.  
  8. Exit_DumbErrorTrap:
  9. Exit sub
  10.  
  11. DumbErrorTrap:
  12. setWarnings = true
  13. 'if you want put an error message here!
  14.  
Member
 
Join Date: Jan 2007
Posts: 56
#5: Apr 5 '07

re: dialog box


Quote:

Originally Posted by Denburt

Missed a parenthesis.
YesNo = MsgBox ("You are about to enter " & rst.RecordCount & " records!", vbInformation+vbYesNo)

Expand|Select|Wrap|Line Numbers
  1. Public Sub Whatever()
  2. On error goto DumbErrorTrap
  3.  
  4. 'Do this and that
  5. loop
  6. setwarnings = true
  7.  
  8. Exit_DumbErrorTrap:
  9. Exit sub
  10.  
  11. DumbErrorTrap:
  12. setWarnings = true
  13. 'if you want put an error message here!
  14.  

I had to add "end if" statements to get the code to work.

But the microsoft dialog box still opened up.

im db As DAO.Database
Dim rst As DAO.Recordset
Dim strName As String
Dim strFaxNo As String
Dim strFax As String
SetWarnings = False
Set db = CurrentDb


strSQL = "SELECT TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep FROM tara INNER JOIN TProdInfo ON tara.ProdCd = TProdInfo.ProdCd GROUP BY TProdInfo.ProdCd, TProdInfo.[Contact Name], TProdInfo.[Fax Number], tara.Keep, tara.Email HAVING (((tara.Keep)=True) AND ((tara.Email)=fOSUserName()));"

Set rst = db.OpenRecordset(strSQL)
'To prevent an error when your recordset is empty use the following
If Not rst.EOF Then
rst.MoveFirst
YesNo = MsgBox("You are about to Fax " & rst.RecordCount & " records!", vbInformation + vbYesNo)
If YesNo = vbNo Then
Exit Sub
End If
Do Until rst.EOF
gProdCd = rst!ProdCd
strName = "/Name=" & rst![Contact Name]
strFaxNo = "/Fax=" & rst![Fax Number]

strFax = strName & strFaxNo & "/<fax@faxit.travp.net>"

DoCmd.SendObject acSendReport, "RPCDemandFax", acFormatRTF, strFax, , , "Outstanding Property Casualty Policies", "Please Review the Following Outstanding Policies", False
rst.MoveNext
Loop
SetWarnings = True
End If
End Sub
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#6: Apr 5 '07

re: dialog box


What does this dialog box say exactly?
Member
 
Join Date: Jan 2007
Posts: 56
#7: Apr 5 '07

re: dialog box


microsoft office outlook

a program is try to automatically send e-mail on your behalf. do you want to allow this? etc

Actually even if I say "NO" it still happens. So NO is not stopping the fax from process.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 11,115
#8: Apr 6 '07

re: dialog box


Quote:

Originally Posted by favor08

microsoft office outlook

a program is try to automatically send e-mail on your behalf. do you want to allow this? etc

Actually even if I say "NO" it still happens. So NO is not stopping the fax from process.

This is a standard outlook warning that can be turned off if you have admin privilages.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 11,115
#9: Apr 6 '07

re: dialog box


Quote:

Originally Posted by mmccarthy

This is a standard outlook warning that can be turned off if you have admin privilages.

If you need another solution have a look at this other thread ...

http://www.thescripts.com/forum/thread609479.html

Mary
Member
 
Join Date: Jan 2007
Posts: 56
#10: Apr 6 '07

re: dialog box


Quote:

Originally Posted by mmccarthy

This is a standard outlook warning that can be turned off if you have admin privilages.

i do have admin privilages, so how do I turn it off.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 11,115
#11: Apr 7 '07

re: dialog box


Quote:

Originally Posted by favor08

i do have admin privilages, so how do I turn it off.

In Outlook go to options and under the security tab click on Attachment Security. Be careful though as this disables all attachment security.

Mary
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#12: Apr 7 '07

re: dialog box


Found this, it will definately need some work but it should do what you need:

Outlook Warnings

Expand|Select|Wrap|Line Numbers
  1. Visual Basic 6 (VBA)
  2. OlSecurityManager.ConnectTo OutlookApp 
  3. OlSecurityManager.DisableOOMWarnings = True 
  4. On Error Goto Finally 
  5.   '... any action with protected objects ... 
  6. Finally: 
  7.   OlSecurityManager.DisableOOMWarnings = False 
  8.  
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#13: Apr 7 '07

re: dialog box


The following link may help also, you will probably need to utilize some of the techniques mentioned in this article in order to implemente the above post.

http://support.microsoft.com/default...b;en-us;291120
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 16,402
#14: Apr 10 '07

re: dialog box


That's brilliant Denburt.
I will be looking to implement this at work from now on.
I Love The Scripts :)
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#15: Apr 10 '07

re: dialog box


Quote:

Originally Posted by NeoPa

That's brilliant Denburt.
I will be looking to implement this at work from now on.
I Love The Scripts :)

Thanks, I had a similar issue a few years ago and as usual I can not seem to find that particular db. I am doing my best to keep up with my code storage db but it is an interesting project in itself. Glad you found it usefull.
Reply