Hi everyone,
I'm really desperate as I do not get something working. I have a multi-user environment, where employees perform Telemarketing and try and close orders over the phone.
I want to create a PDF file, store it on the server, than pick it up as an attachment into Lotus Notes. The file name is generated as RentalAgreement&Customer Number. Customer Number is a field on the form.
Everything works fine if one user is logged in. It appears the problem is the following:
1. User 1 goes to record with Customer Number 001
2. PDF gets created and stored in folder as RentalAgreement001.pdf
3. Than the file gets copied into Archive folder and deleted, still having name RentalAgreement001.pdf
4. Than an email gets created and it pickes up the file from under 3 (from the Archive Folder).
So far so good
5. User 2 goes to record with Custromer Number 999
6. PDF gets created BUT NOT with correct Customer Number but rather with customer number from user 1. so INSTEAD of creating RentalAgreement999.pdf it creates RentalAgreement001.pdf
7. Therefore code stops after step 2 and I get an error message ".....file not found" which is understandable.
I'm so desperate to get this worked out, that I would really appreciate some help.
Here is my code so far:
==============================
Private Sub RentalPDF_Click()
Dim strCustNumber As String
strCustNumber = Forms!frmMeterSales![Customer Number].Value
DoCmd.SetWarnings False
DoCmd.OpenReport "RentalAgreement", acDesign
Reports![RentalAgreement].Caption = "RentalAgreement" & strCustNumber
DoCmd.Close acReport, "RentalAgreement"
'Call the function to print it out.
Call PrinttoPDF("RentalAgreement", "L:\Telesales\CreatedPDF\RentalAgreement & strCustNumber")
Dim PauseTime, Start, Finish
PauseTime = 15
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
Call CopytoArchiveRental
Kill "L:\Telesales\CreatedPDF\RentalAgreement" & strCustNumber & ".pdf"
Call SendNotesMail("Please find your order details attached", "L:\Telesales\CreatedPDF\Archive\RentalAgreement" & strCustNumber & ".pdf", Forms!frmMeterSales!CompanyContactEmail.Value, "", "True")
End Sub
========================
I also have three functions: PrinttoPDF, CopytoArchiveRental and SendNotesMail, which all work fine, so I do not place them here.
I think it has to do with record locking but I do not get it working. I even try and place the [Customer Number] into a new dummy field and than use the dummy field in above code, but still no success as it than simply and wrongly puts the wrong number in the dummy field.
Again, I would really appreciate it if someone can help me with this as I do not know what else to do.
Many thanks and best regards
I'm really desperate as I do not get something working. I have a multi-user environment, where employees perform Telemarketing and try and close orders over the phone.
I want to create a PDF file, store it on the server, than pick it up as an attachment into Lotus Notes. The file name is generated as RentalAgreement&Customer Number. Customer Number is a field on the form.
Everything works fine if one user is logged in. It appears the problem is the following:
1. User 1 goes to record with Customer Number 001
2. PDF gets created and stored in folder as RentalAgreement001.pdf
3. Than the file gets copied into Archive folder and deleted, still having name RentalAgreement001.pdf
4. Than an email gets created and it pickes up the file from under 3 (from the Archive Folder).
So far so good
5. User 2 goes to record with Custromer Number 999
6. PDF gets created BUT NOT with correct Customer Number but rather with customer number from user 1. so INSTEAD of creating RentalAgreement999.pdf it creates RentalAgreement001.pdf
7. Therefore code stops after step 2 and I get an error message ".....file not found" which is understandable.
I'm so desperate to get this worked out, that I would really appreciate some help.
Here is my code so far:
==============================
Private Sub RentalPDF_Click()
Dim strCustNumber As String
strCustNumber = Forms!frmMeterSales![Customer Number].Value
DoCmd.SetWarnings False
DoCmd.OpenReport "RentalAgreement", acDesign
Reports![RentalAgreement].Caption = "RentalAgreement" & strCustNumber
DoCmd.Close acReport, "RentalAgreement"
'Call the function to print it out.
Call PrinttoPDF("RentalAgreement", "L:\Telesales\CreatedPDF\RentalAgreement & strCustNumber")
Dim PauseTime, Start, Finish
PauseTime = 15
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
Call CopytoArchiveRental
Kill "L:\Telesales\CreatedPDF\RentalAgreement" & strCustNumber & ".pdf"
Call SendNotesMail("Please find your order details attached", "L:\Telesales\CreatedPDF\Archive\RentalAgreement" & strCustNumber & ".pdf", Forms!frmMeterSales!CompanyContactEmail.Value, "", "True")
End Sub
========================
I also have three functions: PrinttoPDF, CopytoArchiveRental and SendNotesMail, which all work fine, so I do not place them here.
I think it has to do with record locking but I do not get it working. I even try and place the [Customer Number] into a new dummy field and than use the dummy field in above code, but still no success as it than simply and wrongly puts the wrong number in the dummy field.
Again, I would really appreciate it if someone can help me with this as I do not know what else to do.
Many thanks and best regards