Subform update and Report Preview

B

Bob Mullen

I am having a problem with previewing a report by clicking a command button on the main form. The report is based on the same query that the subform is (it is displayed in datasheet view). If I enter data on the subform and then click the report preview button the report should be based on the data from the subform. It seems to work sometimes but not always. It seems that if I change the date (from a calendar control on the main form) and thereby requery? the subform and then go back to the previous date the report reflects the current data displayed in the subform, but not always. Seems weird to me. Am I missing something related to updating the table or requerying ...

The report preview button's code is stock Access (I have left in some of the things I have tried)

On Error GoTo Err_cmdPreviewReport_Clic

'Me.frmQBF_TeesByDateSubForm.Refres
Dim stDocName As Strin
'Me.frmQBF_TeesByDateSubForm.Requer
stDocName = "rptTeesByDayTBD
DoCmd.OpenReport stDocName, acPrevie

Exit_cmdPreviewReport_Click
Exit Su

Err_cmdPreviewReport_Click
MsgBox Err.Descriptio
Resume Exit_cmdPreviewReport_Clic

I hope I have provided enough information to solve this puzzle. Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top