Printing error in a form

G

Guest

I have created a form that has a print button in it. The button selects a
tick box field that gives a "-1" result in the table. I am attempting to
select only the filed "Work Completed" by either a "True" or "False" or "-1",
but i keep getting either a blank report or a syntax error. i have psoted the
code if someone can help me it would be greatly appreciated

Private Sub PrintCurrentJobList_Click()
On Error GoTo Err_PrintCurrentJobList_Click

Dim stDocName As String

stDocName = "Current JobList"
DoCmd.OpenReport stDocName, acViewPreview, , "work Completed=true"

Exit_PrintCurrentJobList_Click:
Exit Sub

Err_PrintCurrentJobList_Click:
MsgBox Err.Description
Resume Exit_PrintCurrentJobList_Click

End Sub
 
F

fredg

I have created a form that has a print button in it. The button selects a
tick box field that gives a "-1" result in the table. I am attempting to
select only the filed "Work Completed" by either a "True" or "False" or "-1",
but i keep getting either a blank report or a syntax error. i have psoted the
code if someone can help me it would be greatly appreciated

Private Sub PrintCurrentJobList_Click()
On Error GoTo Err_PrintCurrentJobList_Click

Dim stDocName As String

stDocName = "Current JobList"
DoCmd.OpenReport stDocName, acViewPreview, , "work Completed=true"

Exit_PrintCurrentJobList_Click:
Exit Sub

Err_PrintCurrentJobList_Click:
MsgBox Err.Description
Resume Exit_PrintCurrentJobList_Click

End Sub

The hazard of using a space within a control name (work completed) is
that code will fail if you don't surround the name with brackets.

DoCmd.OpenReport stDocName, acViewPreview, , "[work Completed] = true"
 

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