Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Ugh! I should know this...

Geek News

Ugh! I should know this...
Bonnie A 11/26/2008 1:56:05 PM
Hi everyone! Happy Thanksgiving! I'm using A02 on XP and I should know this
by now but it's always just one little thing I miss. Darn it.

I have a record on my subform with a field [PlanNum] and a report with a
query that contains the field [PlanNum]. On my subform, I have a button with
the following OnClick:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
DoCmd.RunCommand acCmdZoom100

What am I missing? I've played with the quotes and can't get it to work.
When I click the button I get a parameter with my actual field value in it
and asking me to fill it in. If I fill in the blank spot with GP0041, it
works. I want it to open without having to satisfy the parameter, I could
put that in the query criteria. If the form is open to GP0041, I want to
view the report showing just that record.

Thank you in advance for your time and assistance. I would be lost without
the newsgroups.
--
Bonnie W. Anderson
Cincinnati, OH
Re: Ugh! I should know this...
Rick Brandt <rickbrandt2[ at ]hotmail.com> 11/26/2008 2:16:55 PM
On Wed, 26 Nov 2008 05:56:05 -0800, Bonnie A wrote:

[Quoted Text]
> Hi everyone! Happy Thanksgiving! I'm using A02 on XP and I should know
> this by now but it's always just one little thing I miss. Darn it.
>
> I have a record on my subform with a field [PlanNum] and a report with a
> query that contains the field [PlanNum]. On my subform, I have a button
> with the following OnClick:
>
> DoCmd.RunCommand acCmdSaveRecord
> DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
> DoCmd.RunCommand acCmdZoom100
>
> What am I missing? I've played with the quotes and can't get it to
> work. When I click the button I get a parameter with my actual field
> value in it and asking me to fill it in. If I fill in the blank spot
> with GP0041, it works. I want it to open without having to satisfy the
> parameter, I could put that in the query criteria. If the form is open
> to GP0041, I want to view the report showing just that record.
>
> Thank you in advance for your time and assistance. I would be lost
> without the newsgroups.

I believe you need one more comma before your criteria. You are using
the FILTER argument and you need to be using the WHERE argument.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Re: Ugh! I should know this...
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 11/26/2008 2:18:56 PM
On Wed, 26 Nov 2008 05:56:05 -0800, Bonnie A
<bonnielynnw[ at ]discussions.microsoft.com> wrote:

Since PlanNum is alphanumeric, it must be wrapped in singlequotes:
DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]='" &
Me.PlanNum & "'"

Put a breakpoint on that line, and ensure Me.PlanNum has the value you
expect.

-Tom.
Microsoft Access MVP


[Quoted Text]
>DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
Re: Ugh! I should know this...
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 11/26/2008 2:25:08 PM
"Bonnie A" <bonnielynnw[ at ]discussions.microsoft.com> wrote in message
news:1CCB1BD3-5001-410A-8532-DD7A0B043B67[ at ]microsoft.com...
[Quoted Text]
> Hi everyone! Happy Thanksgiving! I'm using A02 on XP and I should know
> this
> by now but it's always just one little thing I miss. Darn it.
>
> I have a record on my subform with a field [PlanNum] and a report with a
> query that contains the field [PlanNum]. On my subform, I have a button
> with
> the following OnClick:
>
> DoCmd.RunCommand acCmdSaveRecord
> DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
> DoCmd.RunCommand acCmdZoom100
>
> What am I missing?

Because PlanNum is a text field, you need to embed quotes around the value.
Assuming that it will never contain the single-quote character, try this:

DoCmd.OpenReport "rJanusLtr", acViewPreview, , _
"[PlanNum]='" & Me.PlanNum & "'"


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: Ugh! I should know this...
"BruceM" <bamoob[ at ]yawhodotcalm.not> 11/26/2008 2:30:06 PM
Unless Access 2003 (which I have) is different from Access 2002 (which the
OP has), the Filter argument would follow the first comma, and the Where
argument the second comma, unless I am completely misreading something.

To the OP, is PlanNum a number field? If it is text you need:
"[PlanNum] = """ & Me.PlanNum & """"

Expanded for clarity:
"[PlanNum] = " " " & Me.PlanNum & " " " "

or:
"[PlanNum] = ' " & Me.PlanNum & " ' "

For what exactly is the parameter prompt asking?

If no luck, another thing to try is to eliminate the Where condition, just
to be sure the report opens properly. If you still receive the parameter
prompt with no Where condition, go back to the report's Record Source query
(if it is using a query), or check the Sorting and Grouping.

"Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message
news:rTcXk.9141$YU2.8501[ at ]nlpi066.nbdc.sbc.com...
[Quoted Text]
> On Wed, 26 Nov 2008 05:56:05 -0800, Bonnie A wrote:
>
>> Hi everyone! Happy Thanksgiving! I'm using A02 on XP and I should know
>> this by now but it's always just one little thing I miss. Darn it.
>>
>> I have a record on my subform with a field [PlanNum] and a report with a
>> query that contains the field [PlanNum]. On my subform, I have a button
>> with the following OnClick:
>>
>> DoCmd.RunCommand acCmdSaveRecord
>> DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
>> DoCmd.RunCommand acCmdZoom100
>>
>> What am I missing? I've played with the quotes and can't get it to
>> work. When I click the button I get a parameter with my actual field
>> value in it and asking me to fill it in. If I fill in the blank spot
>> with GP0041, it works. I want it to open without having to satisfy the
>> parameter, I could put that in the query criteria. If the form is open
>> to GP0041, I want to view the report showing just that record.
>>
>> Thank you in advance for your time and assistance. I would be lost
>> without the newsgroups.
>
> I believe you need one more comma before your criteria. You are using
> the FILTER argument and you need to be using the WHERE argument.
>
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com

Re: Ugh! I should know this...
Bonnie A 11/26/2008 2:35:00 PM
Thank you, thank you, thank you!!!

That one ALWAYS gets me.

Your time was truly appreciated!
--
Bonnie W. Anderson
Cincinnati, OH


"Tom van Stiphout" wrote:

[Quoted Text]
> On Wed, 26 Nov 2008 05:56:05 -0800, Bonnie A
> <bonnielynnw[ at ]discussions.microsoft.com> wrote:
>
> Since PlanNum is alphanumeric, it must be wrapped in singlequotes:
> DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]='" &
> Me.PlanNum & "'"
>
> Put a breakpoint on that line, and ensure Me.PlanNum has the value you
> expect.
>
> -Tom.
> Microsoft Access MVP
>
>
> >DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
>
Re: Ugh! I should know this...
Bonnie A 11/26/2008 2:37:02 PM
Hi Dirk,

I truly appreciate the time you put in to help others.

Thank you, it's perfect!
--
Bonnie W. Anderson
Cincinnati, OH


"Dirk Goldgar" wrote:

[Quoted Text]
> "Bonnie A" <bonnielynnw[ at ]discussions.microsoft.com> wrote in message
> news:1CCB1BD3-5001-410A-8532-DD7A0B043B67[ at ]microsoft.com...
> > Hi everyone! Happy Thanksgiving! I'm using A02 on XP and I should know
> > this
> > by now but it's always just one little thing I miss. Darn it.
> >
> > I have a record on my subform with a field [PlanNum] and a report with a
> > query that contains the field [PlanNum]. On my subform, I have a button
> > with
> > the following OnClick:
> >
> > DoCmd.RunCommand acCmdSaveRecord
> > DoCmd.OpenReport "rJanusLtr", acViewPreview, , "[PlanNum]=" & Me.PlanNum
> > DoCmd.RunCommand acCmdZoom100
> >
> > What am I missing?
>
> Because PlanNum is a text field, you need to embed quotes around the value.
> Assuming that it will never contain the single-quote character, try this:
>
> DoCmd.OpenReport "rJanusLtr", acViewPreview, , _
> "[PlanNum]='" & Me.PlanNum & "'"
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net