Getting a report to Filter

B

Bob V

On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in the
query
Thankful if anyone can help.....Bob
 
B

Bob V

Bob V said:
On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in the
query
Thankful if anyone can help.....Bob
Oops Sorry my Report has the text box on it
[qHorseNameSourceAddMode.HorseID]
Thanks Bob
 
L

Larry Linson

Try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!HorseID '****Yellow*****

If that doesn't work, change the name of the Text Box displaying the Field
HorseID to "txtHorseID" and try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!txtHorseID '****Yellow*****

If "HorseID" is a Text Field, rather than a Number Field, you'll need to add
some punctuation.

Larry Linson
Microsoft Access MVP




Bob V said:
Bob V said:
On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in the
query
Thankful if anyone can help.....Bob
Oops Sorry my Report has the text box on it
[qHorseNameSourceAddMode.HorseID]
Thanks Bob
 
B

Bob V

Thanks Larry I copied the Name text box and hid it on my form seems to be
working fine.....Thanx Bob
Private Sub Command682_Click()
On Error GoTo Err_Command12_Click
Dim stDocName As String

DoCmd.OpenReport "HorseInfoOwner", acViewPreview, ,
"[Name]=Forms!frmHorseInfo!Name"

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click
End Sub


Larry Linson said:
Try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!HorseID '****Yellow*****

If that doesn't work, change the name of the Text Box displaying the Field
HorseID to "txtHorseID" and try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!txtHorseID '****Yellow*****

If "HorseID" is a Text Field, rather than a Number Field, you'll need to
add some punctuation.

Larry Linson
Microsoft Access MVP




Bob V said:
Bob V said:
On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in
the query
Thankful if anyone can help.....Bob
Oops Sorry my Report has the text box on it
[qHorseNameSourceAddMode.HorseID]
Thanks Bob
 
L

Larry Linson

A word of caution: Name is not a good name for a Field; it is an Access
reserved word, the name of a property of many objects, including Tables,
Queries, and Fields. Using reserved words can, at best, be confusing; at
worst, you can have errors that may be difficult to debug.

Larry Linson
Microsoft Access MVP


Bob V said:
Thanks Larry I copied the Name text box and hid it on my form seems to be
working fine.....Thanx Bob
Private Sub Command682_Click()
On Error GoTo Err_Command12_Click
Dim stDocName As String

DoCmd.OpenReport "HorseInfoOwner", acViewPreview, ,
"[Name]=Forms!frmHorseInfo!Name"

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click
End Sub


Larry Linson said:
Try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!HorseID '****Yellow*****

If that doesn't work, change the name of the Text Box displaying the
Field HorseID to "txtHorseID" and try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!txtHorseID '****Yellow*****

If "HorseID" is a Text Field, rather than a Number Field, you'll need to
add some punctuation.

Larry Linson
Microsoft Access MVP




Bob V said:
On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in
the query
Thankful if anyone can help.....Bob
Oops Sorry my Report has the text box on it
[qHorseNameSourceAddMode.HorseID]
Thanks Bob
 
B

Bob V

Thanks Larry, I will change it to HorseName?...Regards Bob

Larry Linson said:
A word of caution: Name is not a good name for a Field; it is an Access
reserved word, the name of a property of many objects, including Tables,
Queries, and Fields. Using reserved words can, at best, be confusing; at
worst, you can have errors that may be difficult to debug.

Larry Linson
Microsoft Access MVP


Bob V said:
Thanks Larry I copied the Name text box and hid it on my form seems to be
working fine.....Thanx Bob
Private Sub Command682_Click()
On Error GoTo Err_Command12_Click
Dim stDocName As String

DoCmd.OpenReport "HorseInfoOwner", acViewPreview, ,
"[Name]=Forms!frmHorseInfo!Name"

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click
End Sub


Larry Linson said:
Try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!HorseID '****Yellow*****

If that doesn't work, change the name of the Text Box displaying the
Field HorseID to "txtHorseID" and try

DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
Me!txtHorseID '****Yellow*****

If "HorseID" is a Text Field, rather than a Number Field, you'll need to
add some punctuation.

Larry Linson
Microsoft Access MVP







On my Form I have a Print Preview Control
My Form / has a Text Box [tbHorseID] Control Source [HorseID]

My Report/ rptHorseInfoOwner Control Source is a query that has Field
[qHorseNameSourceAddMode.HorseID]

Print Preview Button, On Click:
DoCmd.OpenReport "rptHorseInfoOwner", acViewPreview, , "HorseID = " &
HorseID '****Yellow*****

I am trying to get the Report to Filter HorseID in Form to HorseID in
the query
Thankful if anyone can help.....Bob
Oops Sorry my Report has the text box on it
[qHorseNameSourceAddMode.HorseID]
Thanks Bob
 

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

Filter a subForm 8
Filter Question 1
Combo Box Filter 3
Continuous Form Question 5
Open Form Code 3
Find Missing Records in a table 1
Script crashes my machine 1
Field Size Dilemma 12

Top