Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Criteria in a crosstab query,problem....

Discussion in 'Information Technology' started by danijela.simunovic@gmail.com, Nov 2, 2005.

  1. danijela.simunovic@gmail.com

    Guest

    Hi!
    I dont know how to get criteria in a crosstab query working!
    If i write something in Criteria it's ok but if I put something like
    this in the Criteria: [Forms]![Form1]![Text1] then it says "The
    microsoft jet database engine does not recognize
    [Forms]![Form1]![Text1] as a valid field name or expression! What do
    i have to do to make it work!?

    Danijela
     
  2. Loading...

    Similar Threads Forum Date
    Criteria: When She Deserves to be Raped Hard Talk Dec 21, 2012
    Sikh News Punjab mulling change in pass criteria in board exams (Outlook India) Breaking News Dec 3, 2007

  3. danijela.simunovic@gmail.com

    Guest

    And one more question.
    In a Select query if the criteria is [Forms]![Form1]![Text1] and
    in that text box(text1) i write "monday" it works but if i
    write "monday Or tuesday" it doesn't work. But if I go to the
    criteria and write "monday Or tuesday" it works. So my question is
    how do i get operators in the text box or somehow so that the criteria
    works?

    Danijela
     
  4. KARL DEWEY

    KARL DEWEY
    Expand Collapse
    Guest

    You can not put "operators" in the textbox. If you want to use more than one
    and they are the days of the week I would suggest using a ListBox with
    multi-select.

    Another way would be to have two TextBox and in the criteria use --
    [Forms]![Form1]![Text1] Or [Forms]![Form1]![Text2] Or is Null

    "danijela.simunovic@gmail.com" wrote:

    > And one more question.
    > In a Select query if the criteria is [Forms]![Form1]![Text1] and
    > in that text box(text1) i write "monday" it works but if i
    > write "monday Or tuesday" it doesn't work. But if I go to the
    > criteria and write "monday Or tuesday" it works. So my question is
    > how do i get operators in the text box or somehow so that the criteria
    > works?
    >
    > Danijela
    >
    >
     
  5. fredg

    fredg
    Expand Collapse
    Guest

    On 1 Nov 2005 14:11:57 -0800, danijela.simunovic@gmail.com wrote:

    > Hi!
    > I dont know how to get criteria in a crosstab query working!
    > If i write something in Criteria it's ok but if I put something like
    > this in the Criteria: [Forms]![Form1]![Text1] then it says "The
    > microsoft jet database engine does not recognize
    > [Forms]![Form1]![Text1] as a valid field name or expression! What do
    > i have to do to make it work!?
    >
    > Danijela


    1) The form "Form1" must be open when the query is run.
    2) In a Crosstab query you MUST write the parameter name and datatype
    in the Parameter dialog box (as well as on the criteria line).
    In query Design View, click on Query + Parameter.
    Write:
    forms!Form1!Text1
    in the left Parameter column and the expected datatype in the right
    column.

    Does this take care of the problem?
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  6. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On 1 Nov 2005 14:11:57 -0800, danijela.simunovic@gmail.com wrote:

    >Hi!
    >I dont know how to get criteria in a crosstab query working!
    >If i write something in Criteria it's ok but if I put something like
    >this in the Criteria: [Forms]![Form1]![Text1] then it says "The
    >microsoft jet database engine does not recognize
    >[Forms]![Form1]![Text1] as a valid field name or expression! What do
    >i have to do to make it work!?
    >
    >Danijela


    It's always *allowed* to specify the Parameters of a query - but for a
    crosstab (and some other queries) it's *required*.

    Open the query in design view; right click the background of the table
    icons; and select Parameters. Put

    [Forms]![Form1]![Text1]

    and specify its datatype (number, date, whatever). They must match
    exactly.

    For your other question - no, you cannot pass operators such as OR,
    IN, commas, etc. in a parameter, only actual values. If you need to
    let the user type in full SQL WHERE clause syntax (and if you trust
    them to do so accurately...!) you'll need to write VBA code to
    construct the SQL string of the entire query on the fly; a parameter
    query won't work.

    John W. Vinson[MVP]
     
  7. zhanghonghao

    zhanghonghao
    Expand Collapse
    Guest

    "KARL DEWEY" <KARLDEWEY@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:BE375CAF-B254-467D-B772-ED327E0CD974@microsoft.com...
    > You can not put "operators" in the textbox. If you want to use more than
    > one
    > and they are the days of the week I would suggest using a ListBox with
    > multi-select.
    >
    > Another way would be to have two TextBox and in the criteria use --
    > [Forms]![Form1]![Text1] Or [Forms]![Form1]![Text2] Or is Null
    >
    > "danijela.simunovic@gmail.com" wrote:
    >
    >> And one more question.
    >> In a Select query if the criteria is [Forms]![Form1]![Text1] and
    >> in that text box(text1) i write "monday" it works but if i
    >> write "monday Or tuesday" it doesn't work. But if I go to the
    >> criteria and write "monday Or tuesday" it works. So my question is
    >> how do i get operators in the text box or somehow so that the criteria
    >> works?
    >>
    >> Danijela
    >>
    >>
     
  8. danijela.simunovic@gmail.com

    Guest

    The parameters take care of the problem! Thanks!
    The other part then i'll just have to use Vb.
     
  9. danijela.simunovic@gmail.com

    Guest

    Can you please tell me how can a query take values from a list box? I
    created it and made it multi select and put it in the query parameters
    but it wont work, the query is empty all the time. Can you help me
    please?
    Thanks!

    Danijela
     
  10. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On 1 Nov 2005 22:59:45 -0800, danijela.simunovic@gmail.com wrote:

    >Can you please tell me how can a query take values from a list box? I
    >created it and made it multi select and put it in the query parameters
    >but it wont work, the query is empty all the time. Can you help me
    >please?
    >Thanks!
    >
    >Danijela


    You do need VBA to accomplish this. See

    http://www.mvps.org/access/forms/frm0007.htm

    for sample code.

    John W. Vinson[MVP]
     

Share This Page