Home > Microsoft Access Help > print report for current record

print report for current record



Let me say this up front. I'm a novice using MS Access. But here's my problem. I have a database created with Access 97 that I have code to run a report for only the current record. It works fine. But when I try to copy the code to another database created in Access 2000, it won't run. I get a run time error "2465 Microsoft Access can't find the field 'I' referred to in your expression".



Here's the code



Dim strWere As String

If Me.Dirty Then 'Save any changes.

Me.Dirty = False

End If

If Me.NewRecord Then

MsgBox "SELECT A RECORD TO PRINT"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "rptPrintRecord", acViewPreview, strWhere

End If



Do I need to change something in the expression or is it because code for 97 is different then 2000.

    
Guest


Look at the first line of your code!!



you have Dim strWere As String don't you mean Dim strWhere.



??????





Regards,

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved