Displaying data on in a report from a form

M

Mabeline

I have created a form that is linked to a table (named Report Table) and the
form (named Select Records) only has one field (unbound text box named Find
Records) where the user enters a tag number (text field in the table) and the
form then is supposed to retrieve all the records in the table that equal the
tag number. It then displays the records in a report which maximizes on the
screen. The code below works but brings all of the records from the table and
not just the ones that equal the inputted tag number. Can anyone show me what
I am doing wrong in this code. I don't know much about this type of code.
Thanks in advance.


Private Sub Find_Records_AfterUpdate()
Dim stDocName As String
Dim strcriteria As String

strcriteria = "Tag Number Like '" & [Find Records] & "'"
strDocName = "Report Table"
DoCmd.OpenReport strDocName, acPreview, strcriteria
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
End Sub


Mabeline
 

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