Hi,
It seems this error is caused for a hundred different reasons. I had it before in the same project in a different procedure but was able to sort it out there.
But this time I'm stuck again.
The setup:
The project is an invoicing system where data from different userforms is passed to tables on different worksheets.
1. User enters data in "Enter Invoice" form and transfers data to 3 different worksheets by clicking a button.
2. User opens another userform from the "Enter Invoice" form (and on top of it) and enters data in "Enter Payment" form. Transfer of data to 2 different worksheets. "Enter Payment" form is closed.
3. User creates PDF for invoice by clicking a button on the "Enter Invoice" form. The PDF opens on top of the "Enter Invoice" form. User prints invoice directly from the PDF. PDF is then closed again.
I use the same procedure for all data transfers. I have not added the code because at this stage I think that is actually has nothing to do with the code itself.
The problem:
As long as the PDF is not actually printed the code does not break. I can enter as many invoices and payments as I like - as long as don't print the PDF (I use the printer button on Adobe Reader). If my user prints the PDFs the code breaks occasionally. Could be after 2 invoices/payments or after 10. Unpredictable.
My user is running this program on 2 different computers, entering all data twice - which is obviously very annoying - just to have a backup in case one program crashes. He runs the same version of MS Office (2013) and the same operating system (Windows 10) on both systems and I have the same setup here too. But this problem existed already when we were still on Windows 7.
As I mentioned already, the user is entering all invoices and payments on 2 different computers. The program crashes only on the computer where the PDF is actually printed. On the backup computer the PDF is created and opened too, in order to save it to the hard drive. But printing is only done regularly from the "main" computer, unless the program crashes - then the invoice is printed from the backup computer. During my testing here on my computer I do not print the PDF either, and I can tell you I already entered hundreds of invoices/payments for testing and debugging reasons and the code didn't break a single time. After a major change in the code my user entered about 30 invoices/payments in the main computer without printing the PDF and no error there either. There was no need to actually print the PDF, he only updated my changed version of the program.
The code always breaks in the sub that is used by all transfers. But it breaks only when the payment data is transferred to the payment sheet. Which is only one of 5 data transfers that are necessary to complete one invoice/payment cycle. It always breaks at the point where a new list row is added to the table.
My question: Has anybody an idea why the actual printing process could cause this error? My user is using a HP printer which is connected to the router and used by both computers.
Any help is very much appreciated!
It seems this error is caused for a hundred different reasons. I had it before in the same project in a different procedure but was able to sort it out there.
But this time I'm stuck again.
The setup:
The project is an invoicing system where data from different userforms is passed to tables on different worksheets.
1. User enters data in "Enter Invoice" form and transfers data to 3 different worksheets by clicking a button.
2. User opens another userform from the "Enter Invoice" form (and on top of it) and enters data in "Enter Payment" form. Transfer of data to 2 different worksheets. "Enter Payment" form is closed.
3. User creates PDF for invoice by clicking a button on the "Enter Invoice" form. The PDF opens on top of the "Enter Invoice" form. User prints invoice directly from the PDF. PDF is then closed again.
I use the same procedure for all data transfers. I have not added the code because at this stage I think that is actually has nothing to do with the code itself.
The problem:
As long as the PDF is not actually printed the code does not break. I can enter as many invoices and payments as I like - as long as don't print the PDF (I use the printer button on Adobe Reader). If my user prints the PDFs the code breaks occasionally. Could be after 2 invoices/payments or after 10. Unpredictable.
My user is running this program on 2 different computers, entering all data twice - which is obviously very annoying - just to have a backup in case one program crashes. He runs the same version of MS Office (2013) and the same operating system (Windows 10) on both systems and I have the same setup here too. But this problem existed already when we were still on Windows 7.
As I mentioned already, the user is entering all invoices and payments on 2 different computers. The program crashes only on the computer where the PDF is actually printed. On the backup computer the PDF is created and opened too, in order to save it to the hard drive. But printing is only done regularly from the "main" computer, unless the program crashes - then the invoice is printed from the backup computer. During my testing here on my computer I do not print the PDF either, and I can tell you I already entered hundreds of invoices/payments for testing and debugging reasons and the code didn't break a single time. After a major change in the code my user entered about 30 invoices/payments in the main computer without printing the PDF and no error there either. There was no need to actually print the PDF, he only updated my changed version of the program.
The code always breaks in the sub that is used by all transfers. But it breaks only when the payment data is transferred to the payment sheet. Which is only one of 5 data transfers that are necessary to complete one invoice/payment cycle. It always breaks at the point where a new list row is added to the table.
My question: Has anybody an idea why the actual printing process could cause this error? My user is using a HP printer which is connected to the router and used by both computers.
Any help is very much appreciated!