two parametre in one query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to create two parametre in one query. l hope it will help users to get
data for a month or for a year

Thanks in advance
 
How to create two parametre in one query. l hope it will help users to get
data for a month or for a year

Thanks in advance

To put two parameters in one query... put two parameters in one query.

I guess I don't understand the question. What's the structure of your
table? If the user responds with a month, or with a year, what do you
want to happen?

John W. Vinson[MVP]
 
thanks john, l solve my problem already about the date but l still have 2
problems.

1. l have a field about student name,class name, book's name and etc.
in criteria l suggest to create 2 parametre ,may l do like this;
student name ; class name
[type student name]and[type class name]

2. May l change a litte bit on my data type at my table .
Detail;
Field Name ; Number.
Data type ; Auto number and l would like to change it to number. without
damage
my queries and reports.Unfortunately , l was create my query and my report
before
l create form. When l test it's not look like what l expected it.

Thanks in advance
 
thanks john, l solve my problem already about the date but l still have 2
problems.

1. l have a field about student name,class name, book's name and etc.
in criteria l suggest to create 2 parametre ,may l do like this;
student name ; class name
[type student name]and[type class name]

No.

In SQL it would be

WHERE [Student Name] = [Type Student Name] AND [Class Name] = [Type
Class Name]

This will return the record only if the user enters *both* a student
name and the name of a class that student is in. Change AND to OR if
you want to return all the classes that the entered student is in,
along with all the students enrolled in the entered class.

In the Query Grid you would just put the [Enter Student Name] on the
query grid Criteria line underneath the [Student Name] field. If you
want to use AND put [Enter Class Name] on the same row of the grid;
for OR logic put it on the next grid line down.
2. May l change a litte bit on my data type at my table .
Detail;
Field Name ; Number.
Data type ; Auto number and l would like to change it to number. without
damage
my queries and reports.Unfortunately , l was create my query and my report
before
l create form. When l test it's not look like what l expected it.

Changing the datatype to number shouldn't affect the queries on data
that is already there. It will make adding new records a bit different
since you will need to (manually or with VBA code) enter a unique ID
value whenever you add a new record. What's changed? What did you
expect, and what are you getting?

John W. Vinson[MVP]
 
Hi John,
Thank you for your help. lt's good enough help me to finish my assigment
especially your VBA code. l'm weak with VBA.

John Vinson said:
thanks john, l solve my problem already about the date but l still have 2
problems.

1. l have a field about student name,class name, book's name and etc.
in criteria l suggest to create 2 parametre ,may l do like this;
student name ; class name
[type student name]and[type class name]

No.

In SQL it would be

WHERE [Student Name] = [Type Student Name] AND [Class Name] = [Type
Class Name]

This will return the record only if the user enters *both* a student
name and the name of a class that student is in. Change AND to OR if
you want to return all the classes that the entered student is in,
along with all the students enrolled in the entered class.

In the Query Grid you would just put the [Enter Student Name] on the
query grid Criteria line underneath the [Student Name] field. If you
want to use AND put [Enter Class Name] on the same row of the grid;
for OR logic put it on the next grid line down.
2. May l change a litte bit on my data type at my table .
Detail;
Field Name ; Number.
Data type ; Auto number and l would like to change it to number. without
damage
my queries and reports.Unfortunately , l was create my query and my report
before
l create form. When l test it's not look like what l expected it.

Changing the datatype to number shouldn't affect the queries on data
that is already there. It will make adding new records a bit different
since you will need to (manually or with VBA code) enter a unique ID
value whenever you add a new record. What's changed? What did you
expect, and what are you getting?

John W. Vinson[MVP]
 
Hi John,
Thank you for your help. lt's good enough help me to finish my assigment
especially your VBA code. l'm weak with VBA.

I hope you're not on the wrong track here Zila - I did not post any
VBA code at all!

John W. Vinson[MVP]
 

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

Back
Top