A family of Microsoft relational database management systems designed for ease of use.
I wrote:
DoCmd.OpenReport "rptHoldingsList", acPreview, , "ContactName= '" & Me.ContactName & "'"
Please replace strCriteria with ContactName and report back.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a command button on my form and would like to run a report filtered on the contents of a tectbox (ContactName) but not having mush luck.
Private Sub Command13_Click()
Dim strCriteria As String
strCriteria = Me.ContactName.Value
' open report in print preview
DoCmd.OpenReport "rptHoldingsList", View:=acViewPreview, WhereCondition:=strCriteria
End Sub
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
I wrote:
DoCmd.OpenReport "rptHoldingsList", acPreview, , "ContactName= '" & Me.ContactName & "'"
Please replace strCriteria with ContactName and report back.
Here is the line:
DoCmd.OpenReport "rptHoldingsList", acPreview, , "strCriteria= '" & Me.ContactName & "'"
and it returns an Enter Parameter dialog
Please check that you have the quotes in this part right.
'" & Me.ContactName & "'"
[SingleQuote][DoubleQuote] & Me.ContactName & [DoubleQuote][SingleQuote][DoubleQuote]
Had to replace ContactName= with strCriteria but it returns all records
Hi
You may like to try this:
DoCmd.OpenReport "rptHoldingsList", acPreview, , "ContactName= '" & Me.ContactName & "'"