This code is running within an MSAccess program and is used to send faxes to our fax server.
The code worked fine until recently when we began to get an error code 5 with a message of "Invalid Procedure Call or Argument" This program runs on a number of desktops using XP, SP3.
*********start of code*************
Function CreateFaxdup() As Variant
Dim mydb As DAO.Database
Dim my1 As DAO.Recordset
Dim Inits As String
Dim delayend As Double
Dim huserid As String
Dim faxhold As String
Dim faxH As String
Dim FaxArea As String
Dim FaxPrefix As String
Dim FaxSuffix As String
Dim rfqrpt1 As String
Dim cnt As Integer
Set mydb = CurrentDb
Set my1 = mydb.OpenRecordset("cust_sel_file1")
huserid = Environ("username")
rfqrpt1 = "c:\prtfile\rptq1.pdf"
my1.MoveFirst
'*************Report 1****************
If Forms!form3!Pcntl = 1 Then
DoCmd.OpenReport "quickquote_em_new"
Else
DoCmd.OpenReport "quickquote_em_new_xx"
End If
delayend = DateAdd("s", 2, Now)
While DateDiff("s", Now, delayend) > 0
Wend
If Len(my1!CustFaxNo) = 7 Then
faxhold = my1!CustFaxNo
ElseIf Len(my1!CustFaxNo) = 8 Then
faxhold = Left(my1!CustFaxNo, 3) + Mid(my1!CustFaxNo, 5, 4)
ElseIf Len(my1!CustFaxNo) = 10 Then
faxhold = "1" + my1!CustFaxNo
ElseIf Len(my1!CustFaxNo) = 12 Then
faxhold = "1" + Left(my1!CustFaxNo, 3) + Mid(my1!CustFaxNo, 5, 3) + Right(my1!CustFaxNo, 4)
End If
Inits = "\\fax\faxpress\submitfax /sfaxpress4 /oc:\prtfile /u" + huserid + " /r" + faxhold + " /a" + rfqrpt1
shell (Inits)
error99:
On Error Resume Next
'Kill rfqhold
Set my1 = Nothing
Set mydb = Nothing
End Function
***********end of code****************
The code worked fine until recently when we began to get an error code 5 with a message of "Invalid Procedure Call or Argument" This program runs on a number of desktops using XP, SP3.
*********start of code*************
Function CreateFaxdup() As Variant
Dim mydb As DAO.Database
Dim my1 As DAO.Recordset
Dim Inits As String
Dim delayend As Double
Dim huserid As String
Dim faxhold As String
Dim faxH As String
Dim FaxArea As String
Dim FaxPrefix As String
Dim FaxSuffix As String
Dim rfqrpt1 As String
Dim cnt As Integer
Set mydb = CurrentDb
Set my1 = mydb.OpenRecordset("cust_sel_file1")
huserid = Environ("username")
rfqrpt1 = "c:\prtfile\rptq1.pdf"
my1.MoveFirst
'*************Report 1****************
If Forms!form3!Pcntl = 1 Then
DoCmd.OpenReport "quickquote_em_new"
Else
DoCmd.OpenReport "quickquote_em_new_xx"
End If
delayend = DateAdd("s", 2, Now)
While DateDiff("s", Now, delayend) > 0
Wend
If Len(my1!CustFaxNo) = 7 Then
faxhold = my1!CustFaxNo
ElseIf Len(my1!CustFaxNo) = 8 Then
faxhold = Left(my1!CustFaxNo, 3) + Mid(my1!CustFaxNo, 5, 4)
ElseIf Len(my1!CustFaxNo) = 10 Then
faxhold = "1" + my1!CustFaxNo
ElseIf Len(my1!CustFaxNo) = 12 Then
faxhold = "1" + Left(my1!CustFaxNo, 3) + Mid(my1!CustFaxNo, 5, 3) + Right(my1!CustFaxNo, 4)
End If
Inits = "\\fax\faxpress\submitfax /sfaxpress4 /oc:\prtfile /u" + huserid + " /r" + faxhold + " /a" + rfqrpt1
shell (Inits)
error99:
On Error Resume Next
'Kill rfqhold
Set my1 = Nothing
Set mydb = Nothing
End Function
***********end of code****************