B
Bob Loder
Hi, Friends,
This was discussed several days ago, and I was pleasantly amazed, because it
was exactly my latest challenge!
I have a form that shows a lot of info on a record by record basis - nothing
glamourous, no subforms - pretty straight forward.
I want to be able to print a "version" of a pre-defined report
(rptWorkInProgress) which works fine by itself when it displays all records
(don't panic, there are only 63 records), but it doesn't like my command
button to print just the current record in report using that report.
I "plagarized" code being discussed on the topic over the weekend, but
actually, the topical issue was never resolved. Still getting error:
===========================================
Run-time error '3075':
Syntax error (missing operator) in query expression
'([Insured]=Devonshire)'.
===========================================
-or-
if name has a comma (Smith, John):
===========================================
Run-time error '3075':
Syntax error (comma) in query expression '([Insured]=Smith, John)'.
===========================================
My code in On Click for command button on Form (as plagarized, and altered
from previous discussion!) is as follows:
=============================================
Private Sub PrintThisRecordFull_Click()
Dim strWhere 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 = "[Insured]=" & Me.[Insured]
DoCmd.OpenReport "rptFullWorkInProgress", acViewPreview, , strWhere
End If
End Sub
==============================================
Debug points me to DoCmd.OpenReport . . . line
Maybe because report calls up all records in Db, not filtered, or locked, or
.. . . ? Similar to original writer, if I invoke command from a blank data
entry screen, I get a predictable "Select A Record To Print".
Ya know, this all seemed easy (report on current record) before I started!
Thanks in advance,
Bob Loder
Tampa, FL
This was discussed several days ago, and I was pleasantly amazed, because it
was exactly my latest challenge!
I have a form that shows a lot of info on a record by record basis - nothing
glamourous, no subforms - pretty straight forward.
I want to be able to print a "version" of a pre-defined report
(rptWorkInProgress) which works fine by itself when it displays all records
(don't panic, there are only 63 records), but it doesn't like my command
button to print just the current record in report using that report.
I "plagarized" code being discussed on the topic over the weekend, but
actually, the topical issue was never resolved. Still getting error:
===========================================
Run-time error '3075':
Syntax error (missing operator) in query expression
'([Insured]=Devonshire)'.
===========================================
-or-
if name has a comma (Smith, John):
===========================================
Run-time error '3075':
Syntax error (comma) in query expression '([Insured]=Smith, John)'.
===========================================
My code in On Click for command button on Form (as plagarized, and altered
from previous discussion!) is as follows:
=============================================
Private Sub PrintThisRecordFull_Click()
Dim strWhere 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 = "[Insured]=" & Me.[Insured]
DoCmd.OpenReport "rptFullWorkInProgress", acViewPreview, , strWhere
End If
End Sub
==============================================
Debug points me to DoCmd.OpenReport . . . line
Maybe because report calls up all records in Db, not filtered, or locked, or
.. . . ? Similar to original writer, if I invoke command from a blank data
entry screen, I get a predictable "Select A Record To Print".
Ya know, this all seemed easy (report on current record) before I started!
Thanks in advance,
Bob Loder
Tampa, FL