Open Report to record on form

B

Bonnie

Hi there. Using A02 on XP. Want to open my report to the same record that is
showing on my form. I have a text field [PlanNum] that is unique. Have the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any help
or advice. The quotes are kickin' my butt today! Thanks in advance for your
time.
 
D

Duane Hookom

You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"
 
B

Bonnie

Duane, you are one of the greats and you were right there for me this
morning. Those quotes, those quotes, those quotes!!!!Ugh! Thank you, it
works great!
--
Bonnie


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Bonnie said:
Hi there. Using A02 on XP. Want to open my report to the same record that
is
showing on my form. I have a text field [PlanNum] that is unique. Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance for
your
time.
 
B

Bonnie

--
Bonnie


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Bonnie said:
Hi there. Using A02 on XP. Want to open my report to the same record that
is
showing on my form. I have a text field [PlanNum] that is unique. Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance for
your
time.
 
O

Ofer

Bonnie, just incase it will ever come up
If the Where condition includes a date field, you should use # before and
after the parm

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[DateField] =#" &
Me![DateField] & "#"


--
I hope that helped
Good luck


Bonnie said:
Duane, you are one of the greats and you were right there for me this
morning. Those quotes, those quotes, those quotes!!!!Ugh! Thank you, it
works great!
--
Bonnie


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Bonnie said:
Hi there. Using A02 on XP. Want to open my report to the same record that
is
showing on my form. I have a text field [PlanNum] that is unique. Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance for
your
time.
 
B

Bonnie

Thanks Ofer for the extra info. I'm sure a date will come up at some point.
I'll keep the info.

Thanks for being willing to help folks learn!!!

--
Bonnie


Ofer said:
Bonnie, just incase it will ever come up
If the Where condition includes a date field, you should use # before and
after the parm

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[DateField] =#" &
Me![DateField] & "#"


--
I hope that helped
Good luck


Bonnie said:
Duane, you are one of the greats and you were right there for me this
morning. Those quotes, those quotes, those quotes!!!!Ugh! Thank you, it
works great!
--
Bonnie


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Hi there. Using A02 on XP. Want to open my report to the same record that
is
showing on my form. I have a text field [PlanNum] that is unique. Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance for
your
time.
 
R

RoadKyng

Duane,
where in the Access help is a good discussion or instructions on the use of
quotes when setting criteria?
--
GmH


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Bonnie said:
Hi there. Using A02 on XP. Want to open my report to the same record that
is
showing on my form. I have a text field [PlanNum] that is unique. Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =" &
Me![PlanNum] - On this one I get a parameter box and the inquiry is my
actual Plan Number like GP2097. If I type the PlanNum into the parameter
box, I get the single record I want. But, I don't want to have to type it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance for
your
time.
 
D

Duane Hookom

I just opened Help while in a module and entered
quotes
in the answer wizard. Much to my surprise, the title of the article
presented is "Quotation Marks in Strings".

The information is quite helpful.

--
Duane Hookom
MS Access MVP
--

RoadKyng said:
Duane,
where in the Access help is a good discussion or instructions on the use
of
quotes when setting criteria?
--
GmH


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Bonnie said:
Hi there. Using A02 on XP. Want to open my report to the same record
that
is
showing on my form. I have a text field [PlanNum] that is unique.
Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] ="
&
Me![PlanNum] - On this one I get a parameter box and the inquiry is
my
actual Plan Number like GP2097. If I type the PlanNum into the
parameter
box, I get the single record I want. But, I don't want to have to type
it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance
for
your
time.
 
R

RoadKyng

Hey thanks. I'll take a look. I haven't quite figured out the system yet.
--
GmH


Duane Hookom said:
I just opened Help while in a module and entered
quotes
in the answer wizard. Much to my surprise, the title of the article
presented is "Quotation Marks in Strings".

The information is quite helpful.

--
Duane Hookom
MS Access MVP
--

RoadKyng said:
Duane,
where in the Access help is a good discussion or instructions on the use
of
quotes when setting criteria?
--
GmH


Duane Hookom said:
You're almost there. Since the field is text, wrap it in quotes like:
DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] =""" &
Me![PlanNum] & """"

--
Duane Hookom
MS Access MVP


Hi there. Using A02 on XP. Want to open my report to the same record
that
is
showing on my form. I have a text field [PlanNum] that is unique.
Have
the
following 2 problems:

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , [PlanNum] =
Me![PlanNum] - This one just opens all the records. If I check the
filter
in the report, it reads (-1). ??? It should read something like
([PlanNum]=GP2097), shouldn't it?

DoCmd.OpenReport "rPenAdvComLevLtr", acViewPreview, , "[PlanNum] ="
&
Me![PlanNum] - On this one I get a parameter box and the inquiry is
my
actual Plan Number like GP2097. If I type the PlanNum into the
parameter
box, I get the single record I want. But, I don't want to have to type
it
into the parameter box.

I know I'm doing something simple simply stupid. Would appreciate any
help
or advice. The quotes are kickin' my butt today! Thanks in advance
for
your
time.
 

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