acPreview with filter

O

Opal

This has got me stumped....maybe because its late
on a Friday, but....

Private Sub cmdViewRegisForm_Click()
On Error GoTo Err_cmdViewRegisForm_Click

Dim stDocName As String
Dim strWhere As String

stDocName = "rptKCRegis"
strWhere = "[txtKCID] = " & Me.KCID

DoCmd.OpenReport stDocName, acPreview, , strWhere

Exit_cmdViewRegisForm_Click:
Exit Sub

Err_cmdViewRegisForm_Click:
MsgBox Err.Description
Resume Exit_cmdViewRegisForm_Click
End Sub

[KCID] is the field name on my form and "txtKCID" is on my report.
However, when I click this button I get a "Enter parameter value" pop-
up for "txtKCID" and I cannot figure out why..... both fields are
numeric fields so quotations are not the issue....

Can anyone offer any insight as to why I cannot open this
report with this filter?
 
D

Damon Heron

the strWhere line should be:
strWhere = "[thecontrolsource of your textbox, not its name] = " & Me.KCID

Damon
 

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

Similar Threads


Top