create any report

D

Database User

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help
 
D

Database User

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot
 
D

Duane Hookom

Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere
 
D

Database User

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


Duane Hookom said:
Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


Database User said:
I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot
 
D

Duane Hookom

A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


Duane Hookom said:
Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


Database User said:
I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

Yes thats exactly what i need - i would want both - that they are able to
select records based on the criteria they enter and also which fields.

The fields part is not as important, but even without that i need to know
how to create a list or combo box where the user can choose the field name to
enter the critera e.g field name would be Age then a box to choose > and then
criteria box would be 20 - that would select students over 20 years old

Thanks a million for all your help

Duane Hookom said:
A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


Duane Hookom said:
Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Duane Hookom

My first reply to you has a link to an applet that allows users to select
fields, operators, and criteria. You may need to modify the solution to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to select the
fields they want to display in a published report. Each field would have
varying sizes and types so it would be near impossible to get a report to
look good without a ton of code. That's why I use the applet from my first
reply to you. Users are happy getting the results sent to Excel or other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


Database User said:
Yes thats exactly what i need - i would want both - that they are able to
select records based on the criteria they enter and also which fields.

The fields part is not as important, but even without that i need to know
how to create a list or combo box where the user can choose the field name to
enter the critera e.g field name would be Age then a box to choose > and then
criteria box would be 20 - that would select students over 20 years old

Thanks a million for all your help

Duane Hookom said:
A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Duane Hookom

The basis of the query by form is allowing users to select a field,
sign/operator, and criteria. This information is then used to build a dynamic
query. In it's simplest form:
- create a combo box with a list of fields
- create a combo box with operators
- create a text box or combo box to enter/select a value
- write some code that builds a where condition that can be used in the
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes i guess you're right i wont give them an option to choose which fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >, etc.
and then a box to fill in the criteria how do i do that? is it in the applet
- i didn't find it
thanks so so much
really appreiciate all your help


Duane Hookom said:
My first reply to you has a link to an applet that allows users to select
fields, operators, and criteria. You may need to modify the solution to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to select the
fields they want to display in a published report. Each field would have
varying sizes and types so it would be near impossible to get a report to
look good without a ton of code. That's why I use the applet from my first
reply to you. Users are happy getting the results sent to Excel or other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


Database User said:
Yes thats exactly what i need - i would want both - that they are able to
select records based on the criteria they enter and also which fields.

The fields part is not as important, but even without that i need to know
how to create a list or combo box where the user can choose the field name to
enter the critera e.g field name would be Age then a box to choose > and then
criteria box would be 20 - that would select students over 20 years old

Thanks a million for all your help

:

A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

yes i guess you're right i wont give them an option to choose which fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >, etc.
and then a box to fill in the criteria how do i do that? is it in the applet
- i didn't find it
thanks so so much
really appreiciate all your help


Duane Hookom said:
My first reply to you has a link to an applet that allows users to select
fields, operators, and criteria. You may need to modify the solution to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to select the
fields they want to display in a published report. Each field would have
varying sizes and types so it would be near impossible to get a report to
look good without a ton of code. That's why I use the applet from my first
reply to you. Users are happy getting the results sent to Excel or other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


Database User said:
Yes thats exactly what i need - i would want both - that they are able to
select records based on the criteria they enter and also which fields.

The fields part is not as important, but even without that i need to know
how to create a list or combo box where the user can choose the field name to
enter the critera e.g field name would be Age then a box to choose > and then
criteria box would be 20 - that would select students over 20 years old

Thanks a million for all your help

Duane Hookom said:
A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

Hello thanks so much for all your help.
i've never done this type of thing before so its a bit foreign to me.
i made the combo box with list of fields
for the operators i could only do a list box - is that ok
and then i just placed an unbound box to be able to type in the criteria

and then did you say that i should have a button next to it that has the
following code:
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
but what should i type after strWhere

also could i place the combo boxed and the unbound box 3 times on the form
that the user can base it on three criterias

thanks so much
i think i'm getting there!

Duane Hookom said:
The basis of the query by form is allowing users to select a field,
sign/operator, and criteria. This information is then used to build a dynamic
query. In it's simplest form:
- create a combo box with a list of fields
- create a combo box with operators
- create a text box or combo box to enter/select a value
- write some code that builds a where condition that can be used in the
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes i guess you're right i wont give them an option to choose which fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >, etc.
and then a box to fill in the criteria how do i do that? is it in the applet
- i didn't find it
thanks so so much
really appreiciate all your help


Duane Hookom said:
My first reply to you has a link to an applet that allows users to select
fields, operators, and criteria. You may need to modify the solution to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to select the
fields they want to display in a published report. Each field would have
varying sizes and types so it would be near impossible to get a report to
look good without a ton of code. That's why I use the applet from my first
reply to you. Users are happy getting the results sent to Excel or other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


:

Yes thats exactly what i need - i would want both - that they are able to
select records based on the criteria they enter and also which fields.

The fields part is not as important, but even without that i need to know
how to create a list or combo box where the user can choose the field name to
enter the critera e.g field name would be Age then a box to choose > and then
criteria box would be 20 - that would select students over 20 years old

Thanks a million for all your help

:

A report criteria form is an unbound form that allows users to enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records that display
in a report or do you think you need to allow users to also select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based on entries in
controls on a form. I generally place a bunch of text, combo, list, and check
boxes on a "report criteria" form. One list box has a Row Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by choosing the criteria
in the form that i mentioned this criteria would go through to a query and
then my clicking on a button a report would be created based on that query.

The report would already be set with all the correct fields the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of something a bit different.

I once saw on a database a form with a drop down menu to choose the field
you want then a drop down menu to choose the function e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be able to record all the
students who apply, who gets accepted / refused / declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I cannot prepare every
single eventuality and she wants to be able to create for herself the most
useful reports that each time she needs something she can create exactly what
she wants and not just use one of my preset ones that will "do the job"

how can i create something that doesn't look complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Duane Hookom

This is not an easy solution to create since you need to build your where
condition differently based on field types.
Assuming combo boxes named cboField & cboOperator and a text box named
txtCriteria....

Your code might look like:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String
Dim strWhere As String
Dim strDelimiter As String
Select Case True
Case IsDate(Me.txtCriteria)
strDelimiter = "#"
Case IsNumeric(Me.txtCriteria)
strDelimiter = ""
Case Else
strDelimiter = """"
End Select
strWhere = "[" & Me.cboField & "] " & Me.cboOperator & " " _
& strDelimiter & Me.txtCriteria & strDelimiter
MsgBox "strWhere: " & strWhere
stDocName = "rptCustomers"
DoCmd.OpenReport stDocName, acPreview, , strWhere

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub


--
Duane Hookom
MS Access MVP

Database User said:
Hello thanks so much for all your help.
i've never done this type of thing before so its a bit foreign to me.
i made the combo box with list of fields
for the operators i could only do a list box - is that ok
and then i just placed an unbound box to be able to type in the criteria

and then did you say that i should have a button next to it that has the
following code:
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
but what should i type after strWhere

also could i place the combo boxed and the unbound box 3 times on the form
that the user can base it on three criterias

thanks so much
i think i'm getting there!

Duane Hookom said:
The basis of the query by form is allowing users to select a field,
sign/operator, and criteria. This information is then used to build a
dynamic
query. In it's simplest form:
- create a combo box with a list of fields
- create a combo box with operators
- create a text box or combo box to enter/select a value
- write some code that builds a where condition that can be used in the
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


Database User said:
yes i guess you're right i wont give them an option to choose which
fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >,
etc.
and then a box to fill in the criteria how do i do that? is it in the
applet
- i didn't find it
thanks so so much
really appreiciate all your help


:

My first reply to you has a link to an applet that allows users to
select
fields, operators, and criteria. You may need to modify the solution
to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to
select the
fields they want to display in a published report. Each field would
have
varying sizes and types so it would be near impossible to get a
report to
look good without a ton of code. That's why I use the applet from my
first
reply to you. Users are happy getting the results sent to Excel or
other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


:

Yes thats exactly what i need - i would want both - that they are
able to
select records based on the criteria they enter and also which
fields.

The fields part is not as important, but even without that i need
to know
how to create a list or combo box where the user can choose the
field name to
enter the critera e.g field name would be Age then a box to choose
and then
criteria box would be 20 - that would select students over 20 years
old

Thanks a million for all your help

:

A report criteria form is an unbound form that allows users to
enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records
that display
in a report or do you think you need to allow users to also
select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it
gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based
on entries in
controls on a form. I generally place a bunch of text, combo,
list, and check
boxes on a "report criteria" form. One list box has a Row
Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that
builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by
choosing the criteria
in the form that i mentioned this criteria would go through
to a query and
then my clicking on a button a report would be created
based on that query.

The report would already be set with all the correct fields
the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of
something a bit different.

I once saw on a database a form with a drop down menu
to choose the field
you want then a drop down menu to choose the function
e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and
easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be
able to record all the
students who apply, who gets accepted / refused /
declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I
cannot prepare every
single eventuality and she wants to be able to
create for herself the most
useful reports that each time she needs something
she can create exactly what
she wants and not just use one of my preset ones
that will "do the job"

how can i create something that doesn't look
complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

Hello Duane

Thank you so so much for all your help. I am having big problems with this.
My database is almost finished - i have a deadline for a week and a half and
i just can't seem to understand how to do this.

Would you or anyone else out there be able to guide me step by step how to
do this?
If not don't worry I would understand I am just a bit at a loss what to do....

Thanks for everything
Duane Hookom said:
This is not an easy solution to create since you need to build your where
condition differently based on field types.
Assuming combo boxes named cboField & cboOperator and a text box named
txtCriteria....

Your code might look like:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String
Dim strWhere As String
Dim strDelimiter As String
Select Case True
Case IsDate(Me.txtCriteria)
strDelimiter = "#"
Case IsNumeric(Me.txtCriteria)
strDelimiter = ""
Case Else
strDelimiter = """"
End Select
strWhere = "[" & Me.cboField & "] " & Me.cboOperator & " " _
& strDelimiter & Me.txtCriteria & strDelimiter
MsgBox "strWhere: " & strWhere
stDocName = "rptCustomers"
DoCmd.OpenReport stDocName, acPreview, , strWhere

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub


--
Duane Hookom
MS Access MVP

Database User said:
Hello thanks so much for all your help.
i've never done this type of thing before so its a bit foreign to me.
i made the combo box with list of fields
for the operators i could only do a list box - is that ok
and then i just placed an unbound box to be able to type in the criteria

and then did you say that i should have a button next to it that has the
following code:
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
but what should i type after strWhere

also could i place the combo boxed and the unbound box 3 times on the form
that the user can base it on three criterias

thanks so much
i think i'm getting there!

Duane Hookom said:
The basis of the query by form is allowing users to select a field,
sign/operator, and criteria. This information is then used to build a
dynamic
query. In it's simplest form:
- create a combo box with a list of fields
- create a combo box with operators
- create a text box or combo box to enter/select a value
- write some code that builds a where condition that can be used in the
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

yes i guess you're right i wont give them an option to choose which
fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >,
etc.
and then a box to fill in the criteria how do i do that? is it in the
applet
- i didn't find it
thanks so so much
really appreiciate all your help


:

My first reply to you has a link to an applet that allows users to
select
fields, operators, and criteria. You may need to modify the solution
to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to
select the
fields they want to display in a published report. Each field would
have
varying sizes and types so it would be near impossible to get a
report to
look good without a ton of code. That's why I use the applet from my
first
reply to you. Users are happy getting the results sent to Excel or
other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


:

Yes thats exactly what i need - i would want both - that they are
able to
select records based on the criteria they enter and also which
fields.

The fields part is not as important, but even without that i need
to know
how to create a list or combo box where the user can choose the
field name to
enter the critera e.g field name would be Age then a box to choose
and then
criteria box would be 20 - that would select students over 20 years
old

Thanks a million for all your help

:

A report criteria form is an unbound form that allows users to
enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records
that display
in a report or do you think you need to allow users to also
select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it
gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based
on entries in
controls on a form. I generally place a bunch of text, combo,
list, and check
boxes on a "report criteria" form. One list box has a Row
Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that
builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by
choosing the criteria
in the form that i mentioned this criteria would go through
to a query and
then my clicking on a button a report would be created
based on that query.

The report would already be set with all the correct fields
the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of
something a bit different.

I once saw on a database a form with a drop down menu
to choose the field
you want then a drop down menu to choose the function
e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and
easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be
able to record all the
students who apply, who gets accepted / refused /
declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I
cannot prepare every
single eventuality and she wants to be able to
create for herself the most
useful reports that each time she needs something
she can create exactly what
she wants and not just use one of my preset ones
that will "do the job"

how can i create something that doesn't look
complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 
D

Database User

Hello Duane

Ok i've really been trying to follow what you said in the multiselect list
box. maybe i'lll do that first and see where to go from there.

so i pasted the code into a module. and then i created the form with a list
box that was multi select and i called it Iboschool_id
then in the query SQL I wrote the following:

SELECT A_Tbl_Students.student_name, A_Tbl_Students.school_id
FROM A_Tbl_Students
WHERE (((IsSelectedVar("I-FrmCreateRpt","Iboschool_id",[school_id]))=-1));

when i try and view the query of go out of it it says
ambiguous name. in query expression
(((IsSelectedVar("I-FrmCreateRpt","Iboschool_id",[school_id]))=-1));

what does that mean? what am i doing wrong?
please help
thanks so much

Database User said:
Hello Duane

Thank you so so much for all your help. I am having big problems with this.
My database is almost finished - i have a deadline for a week and a half and
i just can't seem to understand how to do this.

Would you or anyone else out there be able to guide me step by step how to
do this?
If not don't worry I would understand I am just a bit at a loss what to do....

Thanks for everything
Duane Hookom said:
This is not an easy solution to create since you need to build your where
condition differently based on field types.
Assuming combo boxes named cboField & cboOperator and a text box named
txtCriteria....

Your code might look like:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String
Dim strWhere As String
Dim strDelimiter As String
Select Case True
Case IsDate(Me.txtCriteria)
strDelimiter = "#"
Case IsNumeric(Me.txtCriteria)
strDelimiter = ""
Case Else
strDelimiter = """"
End Select
strWhere = "[" & Me.cboField & "] " & Me.cboOperator & " " _
& strDelimiter & Me.txtCriteria & strDelimiter
MsgBox "strWhere: " & strWhere
stDocName = "rptCustomers"
DoCmd.OpenReport stDocName, acPreview, , strWhere

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub


--
Duane Hookom
MS Access MVP

Database User said:
Hello thanks so much for all your help.
i've never done this type of thing before so its a bit foreign to me.
i made the combo box with list of fields
for the operators i could only do a list box - is that ok
and then i just placed an unbound box to be able to type in the criteria

and then did you say that i should have a button next to it that has the
following code:
DoCmd.OpenReport "rptYourName", acPreview, , strWhere
but what should i type after strWhere

also could i place the combo boxed and the unbound box 3 times on the form
that the user can base it on three criterias

thanks so much
i think i'm getting there!

:

The basis of the query by form is allowing users to select a field,
sign/operator, and criteria. This information is then used to build a
dynamic
query. In it's simplest form:
- create a combo box with a list of fields
- create a combo box with operators
- create a text box or combo box to enter/select a value
- write some code that builds a where condition that can be used in the
DoCmd.OpenReport "rptYourName", acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

yes i guess you're right i wont give them an option to choose which
fields
just the criteria that they want.

so if i wanted like i explained before a combo box to choose the field
heading and then another one to choose the equation sign e.g =, <, >,
etc.
and then a box to fill in the criteria how do i do that? is it in the
applet
- i didn't find it
thanks so so much
really appreiciate all your help


:

My first reply to you has a link to an applet that allows users to
select
fields, operators, and criteria. You may need to modify the solution
to apply
the "where condition" to open an existing report.

I wouldn't go through the effort of allowing users the ability to
select the
fields they want to display in a published report. Each field would
have
varying sizes and types so it would be near impossible to get a
report to
look good without a ton of code. That's why I use the applet from my
first
reply to you. Users are happy getting the results sent to Excel or
other
programs where they are comfortable laying it out and printing.
--
Duane Hookom
Microsoft Access MVP


:

Yes thats exactly what i need - i would want both - that they are
able to
select records based on the criteria they enter and also which
fields.

The fields part is not as important, but even without that i need
to know
how to create a list or combo box where the user can choose the
field name to
enter the critera e.g field name would be Age then a box to choose
and then
criteria box would be 20 - that would select students over 20 years
old

Thanks a million for all your help

:

A report criteria form is an unbound form that allows users to
enter criteria
or filtering information for a report.

Are you asking how to allow the user to determine the records
that display
in a report or do you think you need to allow users to also
select the fields
that display in the report?

--
Duane Hookom
Microsoft Access MVP


:

yes that sounds like what i am trying to do.
but what is a report criteria form?
and when i create a combo or text box how can i get it that it
gives me the
field headings of the query - not the data of the query
thanks so much for all your help


:

Apparently an existing report was opened and filtered based
on entries in
controls on a form. I generally place a bunch of text, combo,
list, and check
boxes on a "report criteria" form. One list box has a Row
Source that is
based on a table of report names that I created.

I then use code in the On Click of a "Run Report" button that
builds a where
condition string:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtStart) Then
strWhere = strWhere & " And [DateFld]>=#" & _
Me.txtStart & "# "
End If
If Not IsNull(Me.txtEnd) Then
strWhere = strWhere & " And [DateFld]<=#" & _
Me.txtEnd & "# "
End If
' more similar code
DoCmd.OpenReport lboReport, acPreview, , strWhere

--
Duane Hookom
Microsoft Access MVP


:

I didn't see how it was done exactly but basically by
choosing the criteria
in the form that i mentioned this criteria would go through
to a query and
then my clicking on a button a report would be created
based on that query.

The report would already be set with all the correct fields
the data would
just change according to the criteria chosen

thanks a lot

:

Define "creates a report"...

--
Duane Hookom
Microsoft Access MVP


:

hi
it looks very interesting but i was thinking of
something a bit different.

I once saw on a database a form with a drop down menu
to choose the field
you want then a drop down menu to choose the function
e.g =, <, > etc and
then a value box to put in the criteria.
and this then creates a report
how do i do that?
thanks so much for your time and help


:

Use the query by form applet found at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.

Users can create and modify their query/reports and
easily send them to
print, Excel, Word, HTML, Graph,...
--
Duane Hookom
Microsoft Access MVP


:

Hello

I am making a database for a college. It has to be
able to record all the
students who apply, who gets accepted / refused /
declines acceptances. Lists
of students in each class etc. etc.

I have customised many reports for the user but I
cannot prepare every
single eventuality and she wants to be able to
create for herself the most
useful reports that each time she needs something
she can create exactly what
she wants and not just use one of my preset ones
that will "do the job"

how can i create something that doesn't look
complicated but will enable the
user to have a lot of flexibility with the data?

thanks a lot
 

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