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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter form to report



 
 
Thread Tools Display Modes
  #11  
Old May 4th, 2006, 06:06 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

I changed the field names like stated, I didn't understand it that way
before, but I get it now. That makes more sense that way when writing code I
now understand. No longer get that error anymore. New one. When I run the
parameter form:

Runtime error '3075':
Missing ), ], or Item in query expression '(1=1 AND
[cboAircraftType]="Astra" AND ([Carpe))'.


Here is the current code I have written:
Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.cboAircraftType) Then
strWhere = strWhere & " AND [cboAircraftType]=""" & _
Me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & "[" & ctl.Tag & "]or"
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or [Complete
Refurbishment] or [Cup Holders] or [Curtain] or [Divan] or [Dye Job] or
[Entertainment] or [Galley] or [Headliner] or [Lavatory] or [Lighting] or
[Loncoin] or [Lower Side Walls] or [Painting] or [Repairs] or [Runner] or
[Seat Belts] or [Seats] or [Table] or [Telephone] or [Various/Miscellaneous]
or [Veneer] or [Windowline]
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, , strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub






  #12  
Old May 4th, 2006, 07:02 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

not sure if it help. I noticed in the error and in the Immediate window, that
wether I selcet on check box or many, the last letter of the last check box
name is missing. Immediate window example:

1=1 AND [cboAircraftType]="Astra" AND ([Carpet]or[Dye Job]or[Galle)

"Duane Hookom" wrote:

In an earlier post, I attempted to make you rename your combo box to use a
standard naming convention.
"If your combo box has a different name then rename it or change the code"
Apparently you didn't change the control name like I suggested.

You should kick your development up a notch and find (and use) a naming
convention that doesn't permit spaces in object names. Also, you should name
significant controls with standardized, significant names. If I intend to
refer to a combo box anywhere in code or queries or other, I name the combo
box beginning with "cbo". There are other prefixes for other types of
controls.
--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
Yes I do need to learn this expressions, I think I may find me an advance
class on this stuff. I find this stuff quit interesting, want to learn it
myself.
That fixed that error. When I ran ran the parameter form, another compile
error:
"Method or data member not found"
It highlighted the .cboAircraftType portion on the 7th line. I
tried
changing it to
.cboAircraft_Type, no luck.

"Duane Hookom" wrote:

Try replace a single quote with a double after the second "=". You should
learn how these expressions are written so that you can trouble-shoot my
typos.

If Not IsNull(Me.Aircraft_Type) Then
strWhere = strWhere & " AND [Aircraft Type]=""" & _
me.cboAircraftType & """ "
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I put the space in, and received a compile error:
Expected: end of statement
The 6th and 7th line now turn red, except for the _ which I just put a
space
before. The "me" gets highlighted by the error message.


Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.Aircraft_Type) Then
6th strWhere = strWhere & " AND [Aircraft Type]="'" & _
7th me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & " [" & ctl.Tag & "] or "
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or ...
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, , strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub








  #13  
Old May 4th, 2006, 09:08 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

Apparently you don't copy and paste the code that I send to you. You are
continually leaving out spaces. There are three missing spaces in the next
section of code from what I posted to you last night. Looking at your debug
result should make two of the spaces fairly obvious.

If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & "[" & ctl.Tag & "]or"
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
not sure if it help. I noticed in the error and in the Immediate window,
that
wether I selcet on check box or many, the last letter of the last check
box
name is missing. Immediate window example:

1=1 AND [cboAircraftType]="Astra" AND ([Carpet]or[Dye Job]or[Galle)

"Duane Hookom" wrote:

In an earlier post, I attempted to make you rename your combo box to use
a
standard naming convention.
"If your combo box has a different name then rename it or change the
code"
Apparently you didn't change the control name like I suggested.

You should kick your development up a notch and find (and use) a naming
convention that doesn't permit spaces in object names. Also, you should
name
significant controls with standardized, significant names. If I intend to
refer to a combo box anywhere in code or queries or other, I name the
combo
box beginning with "cbo". There are other prefixes for other types of
controls.
--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
Yes I do need to learn this expressions, I think I may find me an
advance
class on this stuff. I find this stuff quit interesting, want to learn
it
myself.
That fixed that error. When I ran ran the parameter form, another
compile
error:
"Method or data member not found"
It highlighted the .cboAircraftType portion on the 7th line. I
tried
changing it to
.cboAircraft_Type, no luck.

"Duane Hookom" wrote:

Try replace a single quote with a double after the second "=". You
should
learn how these expressions are written so that you can trouble-shoot
my
typos.

If Not IsNull(Me.Aircraft_Type) Then
strWhere = strWhere & " AND [Aircraft Type]=""" & _
me.cboAircraftType & """ "
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I put the space in, and received a compile error:
Expected: end of statement
The 6th and 7th line now turn red, except for the _ which I just put
a
space
before. The "me" gets highlighted by the error message.


Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.Aircraft_Type) Then
6th strWhere = strWhere & " AND [Aircraft Type]="'" & _
7th me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & " [" & ctl.Tag & "] or "
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or ...
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, ,
strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub










  #14  
Old May 4th, 2006, 11:50 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

I did copy and paste. I went thru and double checked the code. All spaces are
in the place that yours are. I did not find the three spaces that your are
speaking of. I copied then paste the one you just sent, and it made no
change.

"Duane Hookom" wrote:

Apparently you don't copy and paste the code that I send to you. You are
continually leaving out spaces. There are three missing spaces in the next
section of code from what I posted to you last night. Looking at your debug
result should make two of the spaces fairly obvious.

If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & "[" & ctl.Tag & "]or"
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
not sure if it help. I noticed in the error and in the Immediate window,
that
wether I selcet on check box or many, the last letter of the last check
box
name is missing. Immediate window example:

1=1 AND [cboAircraftType]="Astra" AND ([Carpet]or[Dye Job]or[Galle)

"Duane Hookom" wrote:

In an earlier post, I attempted to make you rename your combo box to use
a
standard naming convention.
"If your combo box has a different name then rename it or change the
code"
Apparently you didn't change the control name like I suggested.

You should kick your development up a notch and find (and use) a naming
convention that doesn't permit spaces in object names. Also, you should
name
significant controls with standardized, significant names. If I intend to
refer to a combo box anywhere in code or queries or other, I name the
combo
box beginning with "cbo". There are other prefixes for other types of
controls.
--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
Yes I do need to learn this expressions, I think I may find me an
advance
class on this stuff. I find this stuff quit interesting, want to learn
it
myself.
That fixed that error. When I ran ran the parameter form, another
compile
error:
"Method or data member not found"
It highlighted the .cboAircraftType portion on the 7th line. I
tried
changing it to
.cboAircraft_Type, no luck.

"Duane Hookom" wrote:

Try replace a single quote with a double after the second "=". You
should
learn how these expressions are written so that you can trouble-shoot
my
typos.

If Not IsNull(Me.Aircraft_Type) Then
strWhere = strWhere & " AND [Aircraft Type]=""" & _
me.cboAircraftType & """ "
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I put the space in, and received a compile error:
Expected: end of statement
The 6th and 7th line now turn red, except for the _ which I just put
a
space
before. The "me" gets highlighted by the error message.


Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.Aircraft_Type) Then
6th strWhere = strWhere & " AND [Aircraft Type]="'" & _
7th me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & " [" & ctl.Tag & "] or "
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or ...
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, ,
strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub











  #15  
Old May 5th, 2006, 02:56 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

I didn't add them back in my most recent reply. I'm not sure how the spaces
got lost during your copy and paste.
I expected you to go back to my reply 5/3/2006 9:43 PM. This is another
instance where you should be able to figure this out on your own. I even had
the following comment in my code:
'remove the last " or " from the where clause

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I did copy and paste. I went thru and double checked the code. All spaces
are
in the place that yours are. I did not find the three spaces that your are
speaking of. I copied then paste the one you just sent, and it made no
change.

"Duane Hookom" wrote:

Apparently you don't copy and paste the code that I send to you. You are
continually leaving out spaces. There are three missing spaces in the
next
section of code from what I posted to you last night. Looking at your
debug
result should make two of the spaces fairly obvious.

If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & "[" & ctl.Tag & "]or"
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
not sure if it help. I noticed in the error and in the Immediate
window,
that
wether I selcet on check box or many, the last letter of the last check
box
name is missing. Immediate window example:

1=1 AND [cboAircraftType]="Astra" AND ([Carpet]or[Dye Job]or[Galle)

"Duane Hookom" wrote:

In an earlier post, I attempted to make you rename your combo box to
use
a
standard naming convention.
"If your combo box has a different name then rename it or change the
code"
Apparently you didn't change the control name like I suggested.

You should kick your development up a notch and find (and use) a
naming
convention that doesn't permit spaces in object names. Also, you
should
name
significant controls with standardized, significant names. If I intend
to
refer to a combo box anywhere in code or queries or other, I name the
combo
box beginning with "cbo". There are other prefixes for other types of
controls.
--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
Yes I do need to learn this expressions, I think I may find me an
advance
class on this stuff. I find this stuff quit interesting, want to
learn
it
myself.
That fixed that error. When I ran ran the parameter form, another
compile
error:
"Method or data member not found"
It highlighted the .cboAircraftType portion on the 7th line.
I
tried
changing it to
.cboAircraft_Type, no luck.

"Duane Hookom" wrote:

Try replace a single quote with a double after the second "=". You
should
learn how these expressions are written so that you can
trouble-shoot
my
typos.

If Not IsNull(Me.Aircraft_Type) Then
strWhere = strWhere & " AND [Aircraft Type]=""" & _
me.cboAircraftType & """ "
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I put the space in, and received a compile error:
Expected: end of statement
The 6th and 7th line now turn red, except for the _ which I just
put
a
space
before. The "me" gets highlighted by the error message.


Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.Aircraft_Type) Then
6th strWhere = strWhere & " AND [Aircraft Type]="'" & _
7th me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on
form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & " [" & ctl.Tag & "] or "
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or ...
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, ,
strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub













  #16  
Old May 5th, 2006, 04:48 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Parameter form to report

I went back and recopied and pasted the one from before. Not sure how it got
lost in translation the first time. It now works just as I wanted. Thank you
very much for your patients in helping me and putting up with my
shortcomings. Wouldn't have been able to do it without you.

"Duane Hookom" wrote:

I didn't add them back in my most recent reply. I'm not sure how the spaces
got lost during your copy and paste.
I expected you to go back to my reply 5/3/2006 9:43 PM. This is another
instance where you should be able to figure this out on your own. I even had
the following comment in my code:
'remove the last " or " from the where clause

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I did copy and paste. I went thru and double checked the code. All spaces
are
in the place that yours are. I did not find the three spaces that your are
speaking of. I copied then paste the one you just sent, and it made no
change.

"Duane Hookom" wrote:

Apparently you don't copy and paste the code that I send to you. You are
continually leaving out spaces. There are three missing spaces in the
next
section of code from what I posted to you last night. Looking at your
debug
result should make two of the spaces fairly obvious.

If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & "[" & ctl.Tag & "]or"
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
not sure if it help. I noticed in the error and in the Immediate
window,
that
wether I selcet on check box or many, the last letter of the last check
box
name is missing. Immediate window example:

1=1 AND [cboAircraftType]="Astra" AND ([Carpet]or[Dye Job]or[Galle)

"Duane Hookom" wrote:

In an earlier post, I attempted to make you rename your combo box to
use
a
standard naming convention.
"If your combo box has a different name then rename it or change the
code"
Apparently you didn't change the control name like I suggested.

You should kick your development up a notch and find (and use) a
naming
convention that doesn't permit spaces in object names. Also, you
should
name
significant controls with standardized, significant names. If I intend
to
refer to a combo box anywhere in code or queries or other, I name the
combo
box beginning with "cbo". There are other prefixes for other types of
controls.
--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
Yes I do need to learn this expressions, I think I may find me an
advance
class on this stuff. I find this stuff quit interesting, want to
learn
it
myself.
That fixed that error. When I ran ran the parameter form, another
compile
error:
"Method or data member not found"
It highlighted the .cboAircraftType portion on the 7th line.
I
tried
changing it to
.cboAircraft_Type, no luck.

"Duane Hookom" wrote:

Try replace a single quote with a double after the second "=". You
should
learn how these expressions are written so that you can
trouble-shoot
my
typos.

If Not IsNull(Me.Aircraft_Type) Then
strWhere = strWhere & " AND [Aircraft Type]=""" & _
me.cboAircraftType & """ "
End If

--
Duane Hookom
MS Access MVP

"Aviator" wrote in message
...
I put the space in, and received a compile error:
Expected: end of statement
The 6th and 7th line now turn red, except for the _ which I just
put
a
space
before. The "me" gets highlighted by the error message.


Private Sub OK_Click()

Dim strWhere As String
Dim strOrs As String
Dim ctl As Control
strWhere = "1=1" 'initialize the where clause
If Not IsNull(Me.Aircraft_Type) Then
6th strWhere = strWhere & " AND [Aircraft Type]="'" & _
7th me.cboAircraftType & """ "
End If
For Each ctl In Me.Controls 'loop through all controls on
form
'find the check boxes
If ctl.ControlType = acCheckBox Then
'find the true check boxes
If ctl.Value = True Then
'add to the where clause
strOrs = strOrs & " [" & ctl.Tag & "] or "
End If
End If
Next
If Len(strOrs) 1 Then
'remove the last " or " from the where clause
strOrs = Left(strOrs, Len(strOrs) - 4)
strWhere = strWhere & " AND (" & strOrs & ")"
End If
Debug.Print strWhere
'the final strWhere might look like
'[Airstairs/Entrance] or [Carpet] or [Cockpit Items] or ...
'open the report based on the checked boxes
DoCmd.OpenReport "Type and Work Report", acViewPreview, ,
strWhere

End Sub

Private Sub Close_Click()
DoCmd.Close 'Close Form
End Sub














 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Report opens parameter form, but then query prompts also jkherman Setting Up & Running Reports 8 April 3rd, 2006 10:33 PM
Parameter thru Form Dialog Box for REPORT Sandy Setting Up & Running Reports 16 January 10th, 2006 10:06 AM
Reporting subreport total on main report BobV Setting Up & Running Reports 22 November 1st, 2005 03:19 AM
Need Help In Printing Current Record in Specific Report RNUSZ@OKDPS Setting Up & Running Reports 1 May 16th, 2005 09:06 PM
Still Hoping for help with a Query problem Don Sealer Using Forms 15 November 13th, 2004 06:24 AM


All times are GMT +1. The time now is 05:26 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.