Report prints blank (1 Viewer)

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
Hello friends,

I hope everyone is fine.

I'm having a problem when printing a report after processing a receiving goods. The idea is to print two reports, one of them is a barcoded label(no problem), and the other is a report summary of the item received into inventory, this is the one printing blank.

This is what I have been able to put together so far debugging. I put a break in the code to see if the values carry along the code, and they do, and the report prints with no problem. I removed the break , and I get the blank report:unsure:

Any ideas why the code is behaving like this? so when I look at the step by step, prints, but when i do the rerun without code analysis, it doesn't print :D

The report is based out of a query (GoodReceiptsRpt).


Please let me know if you happen to have any clues, below is a sample of the code im using.

Code:
GRID= form_frmGoodReceiptsSub.GoodReceiptsID.value ' assigns value to print

                        DoCmd.Close acForm, "frmGoodReceiptsItemDetailsIOH"
                        
                        response = MsgBox("Would you like to receive another Line from this Purchase order?", vbYesNo + vbCritical, "Receive another item?")
                
                        If response = vbYes Then
                            MsgBox "Line received", vbInformation
                            
                            Form_frmGoodReceivingDetailsPOdetails.Requery
                            Form_frmGoodReceivingDetailsPOdetails.selectBt.Enabled = True
                            DoCmd.OpenReport "GoodReceiptsRpt", acViewPreview, , "[GoodReceiptsID]=" & GRID
                            DoCmd.OpenReport "RpPrintLabel", acViewPreview, , "SL=" & SLID
                            Exit Sub
                        End If
                        If response = vbNo Then
                            DoCmd.Close acForm, "frmGoodReceivingPoHeader"
                            DoCmd.OpenReport "GoodReceiptsRpt", acViewPreview, , "[GoodReceiptsID]=" & GRID
                            DoCmd.OpenReport "RpPrintLabel", acViewPreview, , "SL=" & SLID
                            MsgBox "Line received", vbInformation
                            
                            Exit Sub ' exit sub and ends the receiving process
                        End If


Best regards,

Rick
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:32
Joined
Oct 29, 2018
Messages
21,454
Hi. When data show up when you debug but don't when run without interruption, it sometimes indicate a timing issue. Try adding some delay to see if it makes any difference.
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
Hi. When data show up when you debug but don't when run without interruption, it sometimes indicate a timing issue. Try adding some delay to see if it makes any difference.
Hello there,

yes, I 100% agree with your observation. I had a similar issue when I tried printing the barcode report, but then I move the code to a lower section and it worked. In this case, how would you add the timing, is there a function that allows that?

Please let me know :)

thank you as always!

Rick
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:32
Joined
May 7, 2009
Messages
19,232
always use [Forms]![Formname] rather than Form_Formname.
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
always use [Forms]![Formname] rather than Form_Formname.
Thank you for your recommendation. I'll try in a bit and report back. also, whats the difference between your method and the one i use?

Best regards,

Rick
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
always use [Forms]![Formname] rather than Form_Formname.
I tried your recommendation, still the same issue. When I run the code without break, the report prints blank, when I add the break to analyze the code, prints with the information.

Rick
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:32
Joined
Oct 29, 2018
Messages
21,454
I tried your recommendation, still the same issue. When I run the code without break, the report prints blank, when I add the break to analyze the code, prints with the information.

Rick
Hi Rick. I don't think @arnelgp was trying to say that would fix your issue. I think that recommendation was for "best practice" purposes only.
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
Hi Rick. I don't think @arnelgp was trying to say that would fix your issue. I think that recommendation was for "best practice" purposes only.
haha, might as well try it :D.

further context : The information I'm trying to print is loaded in subform inside where the user inputs information of the item being received, then after clicking receive item button, information gets transfer inside the subform, the idea is that subform is to be invisible to user.

The subform is based out of a many to many relation, before I try any printing I make sure to close the form where the user enters the information, therefore the subform closes as well. The only thing left to do that I could change, is to replace the data source from the form(table) to a query based input and do the same for the subform, but I'm not sure if this will help the issue. As I mentioned in my earlier post, the information is there when I create a breakpoint, but after removing the breakpoint the report comes out blank.:LOL: playing tricks on me

Rick
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:32
Joined
Oct 29, 2018
Messages
21,454
haha, might as well try it :D.

further context : The information I'm trying to print is loaded in subform inside where the user inputs information of the item being received, then after clicking receive item button, information gets transfer inside the subform, the idea is that subform is to be invisible to user.

The subform is based out of a many to many relation, before I try any printing I make sure to close the form where the user enters the information, therefore the subform closes as well. The only thing left to do that I could change, is to replace the data source from the form(table) to a query based input and do the same for the subform, but I'm not sure if this will help the issue. As I mentioned in my earlier post, the information is there when I create a breakpoint, but after removing the breakpoint the report comes out blank.:LOL: playing tricks on me

Rick
So, have you tried inserting a delay in the code?

You can use the Sleep API or just create a loop.
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
So, have you tried inserting a delay in the code?

You can use the Sleep API or just create a loop.
I added a "do while loop" to recreate a wait time, and still doesn't work. do you know other way of inserting a delay?
 

RickHunter84

Registered User.
Local time
Today, 04:32
Joined
Dec 28, 2019
Messages
85
I just wanted to report that I got it to work by adding a me.refresh just before closing the form where the user inputs the data.

Thank you for your help :)

Rick
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:32
Joined
Oct 29, 2018
Messages
21,454
I just wanted to report that I got it to work by adding a me.refresh just before closing the form where the user inputs the data.

Thank you for your help :)

Rick
Hi. Congratulations! Glad to hear you got it sorted out. Cheers!
 

Users who are viewing this thread

Top Bottom