I have an access form with a command button, cmdPrint. I got some source code from another access website to display a report, which is linked to a query, and only display the report number on my form (which is also my primary key)
Now when i click the cmdPrint button, it prompts me with "Print_PO_Query" but i have no constraints set in that query that it should be asking for. Here is my VBA Code which is in onclick for cmdPrint. Any help would be greatly appreciated!
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[PONumber] = " & Me.[PONumber] & ""
DoCmd.OpenReport "Print PO", acViewPreview, , strWhere
End If
End Sub
Now when i click the cmdPrint button, it prompts me with "Print_PO_Query" but i have no constraints set in that query that it should be asking for. Here is my VBA Code which is in onclick for cmdPrint. Any help would be greatly appreciated!
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[PONumber] = " & Me.[PONumber] & ""
DoCmd.OpenReport "Print PO", acViewPreview, , strWhere
End If
End Sub