By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Print report by filter

P: n/a
N J
Hi,

I am trying to get a report to print based on what ID number I type into a
text box, but it just prints all records in the table :(

Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal

txtOrderID.SetFocus

Thank You,

--

Kind Regards,
Customer Services
P.S. For us to answer your emails efficiently, please always include the
original message. Thank you.
Nov 13 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
you are building your filter but never applying it in the Open event of
your report

DoCmd.OpenReport stDocName, acNormal, strWhere

Nov 13 '05 #2

P: n/a
you are building your filter but never applying it in the Open event of
your report

DoCmd.OpenReport stDocName, acNormal, strWhere

Nov 13 '05 #3

P: n/a
On Wed, 03 Aug 2005 20:45:12 GMT, N J wrote:
Hi,

I am trying to get a report to print based on what ID number I type into a
text box, but it just prints all records in the table :(

Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal

txtOrderID.SetFocus

Thank You,


strWhere is the where clause to filter the records, but you never
added it to the where clause argument position.

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4

P: n/a
On Wed, 03 Aug 2005 20:45:12 GMT, N J wrote:
Hi,

I am trying to get a report to print based on what ID number I type into a
text box, but it just prints all records in the table :(

Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal

txtOrderID.SetFocus

Thank You,


strWhere is the where clause to filter the records, but you never
added it to the where clause argument position.

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #5

P: n/a
N J
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub

--

Kind Regards,
Customer Services
P.S. For us to answer your emails efficiently, please always include the
original message. Thank you.
"fredg" <fg******@example.invalid> wrote in message
news:d3*****************************@40tude.net...
On Wed, 03 Aug 2005 20:45:12 GMT, N J wrote:
Hi,

I am trying to get a report to print based on what ID number I type into
a
text box, but it just prints all records in the table :(

Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal

txtOrderID.SetFocus

Thank You,


strWhere is the where clause to filter the records, but you never
added it to the where clause argument position.

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #6

P: n/a
N J
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub

--

Kind Regards,
Customer Services
P.S. For us to answer your emails efficiently, please always include the
original message. Thank you.
"fredg" <fg******@example.invalid> wrote in message
news:d3*****************************@40tude.net...
On Wed, 03 Aug 2005 20:45:12 GMT, N J wrote:
Hi,

I am trying to get a report to print based on what ID number I type into
a
text box, but it just prints all records in the table :(

Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal

txtOrderID.SetFocus

Thank You,


strWhere is the where clause to filter the records, but you never
added it to the where clause argument position.

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #7

P: n/a
On Wed, 03 Aug 2005 22:30:25 GMT, N J wrote:
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub


Look at my reply again.
You didn't place the strWhere in the correct position.
It goes in the Where clause argument position.
You placed it in the Filter position.
That's what those 3 commas are for.
If you leave one out it won't work.
Docmd.OpenReport "TheReportName", View, Filter, Where

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #8

P: n/a
On Wed, 03 Aug 2005 22:30:25 GMT, N J wrote:
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub


Look at my reply again.
You didn't place the strWhere in the correct position.
It goes in the Where clause argument position.
You placed it in the Filter position.
That's what those 3 commas are for.
If you leave one out it won't work.
Docmd.OpenReport "TheReportName", View, Filter, Where

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #9

P: n/a
N J
Hi,

Sorry, I misread your message, it seems fine now.

--

Kind Regards,
Customer Services
P.S. For us to answer your emails efficiently, please always include the
original message. Thank you.
"fredg" <fg******@example.invalid> wrote in message
news:6w*****************************@40tude.net...
On Wed, 03 Aug 2005 22:30:25 GMT, N J wrote:
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub


Look at my reply again.
You didn't place the strWhere in the correct position.
It goes in the Where clause argument position.
You placed it in the Filter position.
That's what those 3 commas are for.
If you leave one out it won't work.
Docmd.OpenReport "TheReportName", View, Filter, Where

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #10

P: n/a
N J
Hi,

Sorry, I misread your message, it seems fine now.

--

Kind Regards,
Customer Services
P.S. For us to answer your emails efficiently, please always include the
original message. Thank you.
"fredg" <fg******@example.invalid> wrote in message
news:6w*****************************@40tude.net...
On Wed, 03 Aug 2005 22:30:25 GMT, N J wrote:
Hi,

It still does the same problem :s...

Private Sub cmdGetOrderStatus_Click()
Dim stDocName As String
Dim strWhere As String

strWhere = "[ID] = " & Me.[txtOrderID]

stDocName = "rptLabelsWDM_single"
DoCmd.OpenReport stDocName, acNormal, strWhere

txtOrderID.SetFocus
End Sub


Look at my reply again.
You didn't place the strWhere in the correct position.
It goes in the Where clause argument position.
You placed it in the Filter position.
That's what those 3 commas are for.
If you leave one out it won't work.
Docmd.OpenReport "TheReportName", View, Filter, Where

DoCmd.OpenReport stDocName, acNormal, ,strWhere

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.