Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not always printing data on a report

Status
Not open for further replies.

jeffwest21

IS-IT--Management
Apr 4, 2013
60
GB
I have a series of forms that after a user has entered some data, on submit also prints out a report, there are times when the report doesn't always print out the data (text fields and bar chart) it just comes out blank.

I am using this in my vba code

DoCmd.OpenReport "Agent_Report_Nodd_Com", acPreViewReport, , "Report_Mon_ID = " & Me.ID.Value

The Me.id is a form identity field that is picked up, the report then queries the backend SQL database to get the data. This is consistent, in that it does pull it back except for a few users.

If I add a pause will this solve the issue?? or do I need to do something else to make this work everytime?

'Clever boy...'
 
If this is a new record, it might not be saved/committed to the database. Try add a line of code to save the record prior to opening the report.

Code:
[COLOR=#4E9A06]' save the current record[/color]
    If Me.Dirty Then
        Me.Dirty = False
    End If
    DoCmd.OpenReport "Agent_Report_Nodd_Com", acPreViewReport, , "Report_Mon_ID = " & Me.ID.Value


Duane
Hook'D on Access
MS Access MVP
 
Duane

Thanks for that, however, the record is beuing updated by the user not a brand new one created, sorry, that wasn't very clear of me.

I have looked at the update command, and made sure that it is happening before the open report, and it is.

'Clever boy...'
 
So you are suggesting the same code to open the report works for some and doesn't display any data from the record source for other users?

I'm not sure I have heard of this. Is the record source somewhat complex?

Duane
Hook'D on Access
MS Access MVP
 
Not overly, the call to the report pulls in the id, the report itself reads data from a table where the data is pushed to once submit is pressed on the form, by way of a stored procedure, which again uses the ID.

It does seem strange that it is only some users, I can't ever replicate it and because it's an auto process, by the time it's printed out the table has been cleared.

TBH I was just trying to negate any obvious system errors before i throw it back at IT and get them to check network/printer settings again.

'Clever boy...'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top