I am creating and sending a fax using our fax server.
This code worked great up until about a week ago.
Now I get the code=5 Invalid Procedure Call or Argument
This is part of a ACCESS mdb file that runs on the local PC's.
***********code start******************
Function CreateFax() As Variant
Dim mydb As DAO.Database
Dim my1 As DAO.Recordset
Set mydb = CurrentDb
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 debug highlites the 'shell(Inits)' line
Any ideas why this has suddenly turned up?
This code worked great up until about a week ago.
Now I get the code=5 Invalid Procedure Call or Argument
This is part of a ACCESS mdb file that runs on the local PC's.
***********code start******************
Function CreateFax() As Variant
Dim mydb As DAO.Database
Dim my1 As DAO.Recordset
Set mydb = CurrentDb
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 debug highlites the 'shell(Inits)' line
Any ideas why this has suddenly turned up?