A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

It is possible?



 
 
Thread Tools Display Modes
  #11  
Old November 24th, 2008, 08:36 PM posted to microsoft.public.access.gettingstarted
Sylvie
external usenet poster
 
Posts: 58
Default It is possible?

There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest]) = "&
Me.ListMonths

End Sub

Do you think it could be my Access version 2003? I am dealing with two
errors. On the other form Visit, I have a combo box that open a form
Subjects, and whrn I add new record it show the error : I cannot add because
the record it been used on table Visit. I searched all the codes, on Allen's,
on examples over here, and nothing. The code is for Not in list cbo event.
Should it have a code on the after updade also? I know it is simple however
for any reason it have been a nigthmare, I can't even sleep. HELP ME!

"Douglas J. Steele" wrote:

And the report opens fine if you don't have the criteria?

Your syntax looks correct. I don't know what could be wrong.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Hi Douglas,
i put code on the immediate and hit enter showed the number 6 and I daved
it, when i tried to check it ocurred the same syntax error. Yes, the
Multiselect is set to NOne.

"Douglas J. Steele" wrote:

That will only work if ListMonths has its Multiselect property set to
None.

If you select something in the list box then go to the immediate window
(Ctrl-G), type

?Forms![NameOfForm]!ListMonths

(using the actual form name where it says "NameOfForm") then hit enter,
what
do you get?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest])
=
"&
Me.ListMonths

"BruceM" wrote:

Did you add the quote after the = sign as I suggested? Please post
the
line
of code if you continue to have problems.

You are correct, lstMonths is the list box name.

"Sylvie" wrote in message
...
Thanks Bruce for your help. I am getting a syntax error now; I've
changed
to
my report name. Just to be sure lstmonths is the list box name,
right?I've
changed also. TIA

"BruceM" wrote:

Try closing the quote:
DoCmd.OpenReport "ReportName", acViewPreview, ,
"Month([DateOfTest]) =
"
&
Me.lstMonths

Use your own control name and report name, of course. I think you
have
done
that, but I'll mention it just to be sure.


"Sylvie" wrote in message
...
Thanks a bunch Arvin, I put the code at the on click event and I
got
an
"compile error:invalid use of property", and it highlight the
Me.ListMonths.
TIA

"Arvin Meyer [MVP]" wrote:

DoCmd.OpenReport "ReportName", acViewPreview,,
"Month([DateOfTest])
=
&
Me.lstMonths

Put the month numbers in the first, bound column of your listbox
and
set
the
width of that column to 0" so it won't be seen.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Sylvie" wrote in message
...
I have a report group by month, where on the query I have a
expxression:Expr1: Format([DateOfTEst],"mmmm/yyyy").

My question is: can I have a list box with month January,
February,
etc...;
so when the user check on the month i have the report on that
month.
I've
searched on the threads but it have start date and end date,
which
is
not
my
case. TIA













  #12  
Old November 25th, 2008, 03:55 AM posted to microsoft.public.access.gettingstarted
Sylvie
external usenet poster
 
Posts: 58
Default It is possible?

For the problem number 2 I find the error: The tables were one to many; I've
changed to ono to one and worked. TXS.

"Sylvie" wrote:

There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest]) = "&
Me.ListMonths

End Sub

Do you think it could be my Access version 2003? I am dealing with two
errors. On the other form Visit, I have a combo box that open a form
Subjects, and whrn I add new record it show the error : I cannot add because
the record it been used on table Visit. I searched all the codes, on Allen's,
on examples over here, and nothing. The code is for Not in list cbo event.
Should it have a code on the after updade also? I know it is simple however
for any reason it have been a nigthmare, I can't even sleep. HELP ME!

"Douglas J. Steele" wrote:

And the report opens fine if you don't have the criteria?

Your syntax looks correct. I don't know what could be wrong.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Hi Douglas,
i put code on the immediate and hit enter showed the number 6 and I daved
it, when i tried to check it ocurred the same syntax error. Yes, the
Multiselect is set to NOne.

"Douglas J. Steele" wrote:

That will only work if ListMonths has its Multiselect property set to
None.

If you select something in the list box then go to the immediate window
(Ctrl-G), type

?Forms![NameOfForm]!ListMonths

(using the actual form name where it says "NameOfForm") then hit enter,
what
do you get?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest])
=
"&
Me.ListMonths

"BruceM" wrote:

Did you add the quote after the = sign as I suggested? Please post
the
line
of code if you continue to have problems.

You are correct, lstMonths is the list box name.

"Sylvie" wrote in message
...
Thanks Bruce for your help. I am getting a syntax error now; I've
changed
to
my report name. Just to be sure lstmonths is the list box name,
right?I've
changed also. TIA

"BruceM" wrote:

Try closing the quote:
DoCmd.OpenReport "ReportName", acViewPreview, ,
"Month([DateOfTest]) =
"
&
Me.lstMonths

Use your own control name and report name, of course. I think you
have
done
that, but I'll mention it just to be sure.


"Sylvie" wrote in message
...
Thanks a bunch Arvin, I put the code at the on click event and I
got
an
"compile error:invalid use of property", and it highlight the
Me.ListMonths.
TIA

"Arvin Meyer [MVP]" wrote:

DoCmd.OpenReport "ReportName", acViewPreview,,
"Month([DateOfTest])
=
&
Me.lstMonths

Put the month numbers in the first, bound column of your listbox
and
set
the
width of that column to 0" so it won't be seen.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Sylvie" wrote in message
...
I have a report group by month, where on the query I have a
expxression:Expr1: Format([DateOfTEst],"mmmm/yyyy").

My question is: can I have a list box with month January,
February,
etc...;
so when the user check on the month i have the report on that
month.
I've
searched on the threads but it have start date and end date,
which
is
not
my
case. TIA













  #13  
Old November 25th, 2008, 12:16 PM posted to microsoft.public.access.gettingstarted
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default It is possible?

If you end the line of code after acViewPreview the report opens? Is
DateOfTest a date/time field? Try substituting a number for Me.ListMonths:
...."Month([DateOfTest]) = " & 6

If still no luck, try adding this before the DoCmd line of code:
Debug.Print Month([DateOfTest])
This will show you the value in the immediate window. If the code breaks
where it has in the past, look at the immediate window (it's labeled
"Immediate"; press Ctrl + G if you do not see it, as has been described).
Do you see a number there?
Alternatively you could do:
MsgBox Month([DateOfTest])


"Sylvie" wrote in message
...
There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest]) =
"&
Me.ListMonths

End Sub

Do you think it could be my Access version 2003? I am dealing with two
errors. On the other form Visit, I have a combo box that open a form
Subjects, and whrn I add new record it show the error : I cannot add
because
the record it been used on table Visit. I searched all the codes, on
Allen's,
on examples over here, and nothing. The code is for Not in list cbo event.
Should it have a code on the after updade also? I know it is simple
however
for any reason it have been a nigthmare, I can't even sleep. HELP ME!

"Douglas J. Steele" wrote:

And the report opens fine if you don't have the criteria?

Your syntax looks correct. I don't know what could be wrong.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Hi Douglas,
i put code on the immediate and hit enter showed the number 6 and I
daved
it, when i tried to check it ocurred the same syntax error. Yes, the
Multiselect is set to NOne.

"Douglas J. Steele" wrote:

That will only work if ListMonths has its Multiselect property set to
None.

If you select something in the list box then go to the immediate
window
(Ctrl-G), type

?Forms![NameOfForm]!ListMonths

(using the actual form name where it says "NameOfForm") then hit
enter,
what
do you get?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, ,
"Month([DateOfTest])
=
"&
Me.ListMonths

"BruceM" wrote:

Did you add the quote after the = sign as I suggested? Please post
the
line
of code if you continue to have problems.

You are correct, lstMonths is the list box name.

"Sylvie" wrote in message
...
Thanks Bruce for your help. I am getting a syntax error now; I've
changed
to
my report name. Just to be sure lstmonths is the list box name,
right?I've
changed also. TIA

"BruceM" wrote:

Try closing the quote:
DoCmd.OpenReport "ReportName", acViewPreview, ,
"Month([DateOfTest]) =
"
&
Me.lstMonths

Use your own control name and report name, of course. I think
you
have
done
that, but I'll mention it just to be sure.


"Sylvie" wrote in message
...
Thanks a bunch Arvin, I put the code at the on click event and
I
got
an
"compile error:invalid use of property", and it highlight the
Me.ListMonths.
TIA

"Arvin Meyer [MVP]" wrote:

DoCmd.OpenReport "ReportName", acViewPreview,,
"Month([DateOfTest])
=
&
Me.lstMonths

Put the month numbers in the first, bound column of your
listbox
and
set
the
width of that column to 0" so it won't be seen.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Sylvie" wrote in message
...
I have a report group by month, where on the query I have a
expxression:Expr1: Format([DateOfTEst],"mmmm/yyyy").

My question is: can I have a list box with month January,
February,
etc...;
so when the user check on the month i have the report on
that
month.
I've
searched on the threads but it have start date and end
date,
which
is
not
my
case. TIA














  #14  
Old November 25th, 2008, 04:52 PM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default It is possible?

"Sylvie" wrote in message
...
There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest]) =
"&
Me.ListMonths

End Sub



If I'm reading that correctly, and you copied and pasted the code, then you
are missing the required space between the closing quote and the ampersand.

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

(please reply to the newsgroup)

  #15  
Old November 25th, 2008, 07:15 PM posted to microsoft.public.access.gettingstarted
Sylvie
external usenet poster
 
Posts: 58
Default It is possible?

Bruce,
DateofTest is a date/time, query has it as well as the report. Also I have
the expression to convert in mmm. So on the report is grouped by
expression:=Month([Expr1]). And the Expr1 is :Expr1:
Format([DateOfTEst],"mmmm/yyyy").
MAybe somewhere lays the dilemma.
When I did what you suggested of ending the code on acPreview it worked,
however when I click on July it showed all months. For the other options did
not work. TIA
"BruceM" wrote:

If you end the line of code after acViewPreview the report opens? Is
DateOfTest a date/time field? Try substituting a number for Me.ListMonths:
...."Month([DateOfTest]) = " & 6

If still no luck, try adding this before the DoCmd line of code:
Debug.Print Month([DateOfTest])
This will show you the value in the immediate window. If the code breaks
where it has in the past, look at the immediate window (it's labeled
"Immediate"; press Ctrl + G if you do not see it, as has been described).
Do you see a number there?
Alternatively you could do:
MsgBox Month([DateOfTest])


"Sylvie" wrote in message
...
There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest]) =
"&
Me.ListMonths

End Sub

Do you think it could be my Access version 2003? I am dealing with two
errors. On the other form Visit, I have a combo box that open a form
Subjects, and whrn I add new record it show the error : I cannot add
because
the record it been used on table Visit. I searched all the codes, on
Allen's,
on examples over here, and nothing. The code is for Not in list cbo event.
Should it have a code on the after updade also? I know it is simple
however
for any reason it have been a nigthmare, I can't even sleep. HELP ME!

"Douglas J. Steele" wrote:

And the report opens fine if you don't have the criteria?

Your syntax looks correct. I don't know what could be wrong.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Hi Douglas,
i put code on the immediate and hit enter showed the number 6 and I
daved
it, when i tried to check it ocurred the same syntax error. Yes, the
Multiselect is set to NOne.

"Douglas J. Steele" wrote:

That will only work if ListMonths has its Multiselect property set to
None.

If you select something in the list box then go to the immediate
window
(Ctrl-G), type

?Forms![NameOfForm]!ListMonths

(using the actual form name where it says "NameOfForm") then hit
enter,
what
do you get?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, ,
"Month([DateOfTest])
=
"&
Me.ListMonths

"BruceM" wrote:

Did you add the quote after the = sign as I suggested? Please post
the
line
of code if you continue to have problems.

You are correct, lstMonths is the list box name.

"Sylvie" wrote in message
...
Thanks Bruce for your help. I am getting a syntax error now; I've
changed
to
my report name. Just to be sure lstmonths is the list box name,
right?I've
changed also. TIA

"BruceM" wrote:

Try closing the quote:
DoCmd.OpenReport "ReportName", acViewPreview, ,
"Month([DateOfTest]) =
"
&
Me.lstMonths

Use your own control name and report name, of course. I think
you
have
done
that, but I'll mention it just to be sure.


"Sylvie" wrote in message
...
Thanks a bunch Arvin, I put the code at the on click event and
I
got
an
"compile error:invalid use of property", and it highlight the
Me.ListMonths.
TIA

"Arvin Meyer [MVP]" wrote:

DoCmd.OpenReport "ReportName", acViewPreview,,
"Month([DateOfTest])
=
&
Me.lstMonths

Put the month numbers in the first, bound column of your
listbox
and
set
the
width of that column to 0" so it won't be seen.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Sylvie" wrote in message
...
I have a report group by month, where on the query I have a
expxression:Expr1: Format([DateOfTEst],"mmmm/yyyy").

My question is: can I have a list box with month January,
February,
etc...;
so when the user check on the month i have the report on
that
month.
I've
searched on the threads but it have start date and end
date,
which
is
not
my
case. TIA















  #16  
Old November 26th, 2008, 12:20 PM posted to microsoft.public.access.gettingstarted
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default It is possible?

Month does not care about the format of the date. Just use
Month([DateOfTest]). The Month function can work on a string that Access
recognzes as a valid date, but November/2008 is not such a string. It could
well be the problem. It is also an important detail that you would have
done well to describe a while ago.

I don't know what you mean when you say you "click on July", but omitting
the two commas and:
"Month([DateOfTest]) = " & Me.ListMonths
means you are omitting what is called the Where condition. In other words
you are opening the report with all records. the idea was to see if the
report opens at all. It does. Now we know the problem is the Where
condition.


"Sylvie" wrote in message
...
Bruce,
DateofTest is a date/time, query has it as well as the report. Also I have
the expression to convert in mmm. So on the report is grouped by
expression:=Month([Expr1]). And the Expr1 is :Expr1:
Format([DateOfTEst],"mmmm/yyyy").
MAybe somewhere lays the dilemma.
When I did what you suggested of ending the code on acPreview it worked,
however when I click on July it showed all months. For the other options
did
not work. TIA
"BruceM" wrote:

If you end the line of code after acViewPreview the report opens? Is
DateOfTest a date/time field? Try substituting a number for
Me.ListMonths:
...."Month([DateOfTest]) = " & 6

If still no luck, try adding this before the DoCmd line of code:
Debug.Print Month([DateOfTest])
This will show you the value in the immediate window. If the code breaks
where it has in the past, look at the immediate window (it's labeled
"Immediate"; press Ctrl + G if you do not see it, as has been described).
Do you see a number there?
Alternatively you could do:
MsgBox Month([DateOfTest])


"Sylvie" wrote in message
...
There is the code:
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, , "Month([DateOfTest])
=
"&
Me.ListMonths

End Sub

Do you think it could be my Access version 2003? I am dealing with two
errors. On the other form Visit, I have a combo box that open a form
Subjects, and whrn I add new record it show the error : I cannot add
because
the record it been used on table Visit. I searched all the codes, on
Allen's,
on examples over here, and nothing. The code is for Not in list cbo
event.
Should it have a code on the after updade also? I know it is simple
however
for any reason it have been a nigthmare, I can't even sleep. HELP ME!

"Douglas J. Steele" wrote:

And the report opens fine if you don't have the criteria?

Your syntax looks correct. I don't know what could be wrong.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Hi Douglas,
i put code on the immediate and hit enter showed the number 6 and I
daved
it, when i tried to check it ocurred the same syntax error. Yes,
the
Multiselect is set to NOne.

"Douglas J. Steele" wrote:

That will only work if ListMonths has its Multiselect property set
to
None.

If you select something in the list box then go to the immediate
window
(Ctrl-G), type

?Forms![NameOfForm]!ListMonths

(using the actual form name where it says "NameOfForm") then hit
enter,
what
do you get?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sylvie" wrote in message
...
Private Sub ListMonths_Click()
DoCmd.OpenReport "ReportPTMonth", acViewPreview, ,
"Month([DateOfTest])
=
"&
Me.ListMonths

"BruceM" wrote:

Did you add the quote after the = sign as I suggested? Please
post
the
line
of code if you continue to have problems.

You are correct, lstMonths is the list box name.

"Sylvie" wrote in message
...
Thanks Bruce for your help. I am getting a syntax error now;
I've
changed
to
my report name. Just to be sure lstmonths is the list box
name,
right?I've
changed also. TIA

"BruceM" wrote:

Try closing the quote:
DoCmd.OpenReport "ReportName", acViewPreview, ,
"Month([DateOfTest]) =
"
&
Me.lstMonths

Use your own control name and report name, of course. I
think
you
have
done
that, but I'll mention it just to be sure.


"Sylvie" wrote in message
...
Thanks a bunch Arvin, I put the code at the on click event
and
I
got
an
"compile error:invalid use of property", and it highlight
the
Me.ListMonths.
TIA

"Arvin Meyer [MVP]" wrote:

DoCmd.OpenReport "ReportName", acViewPreview,,
"Month([DateOfTest])
=
&
Me.lstMonths

Put the month numbers in the first, bound column of your
listbox
and
set
the
width of that column to 0" so it won't be seen.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Sylvie" wrote in
message
...
I have a report group by month, where on the query I have
a
expxression:Expr1: Format([DateOfTEst],"mmmm/yyyy").

My question is: can I have a list box with month
January,
February,
etc...;
so when the user check on the month i have the report on
that
month.
I've
searched on the threads but it have start date and end
date,
which
is
not
my
case. TIA
















 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.