Getting a report to Filter

  • Thread starter Thread starter Bob V
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top