Results 1 to 5 of 5

Thread: sql statement

  1. #1
    Join Date
    Nov 2003
    Location
    New Zealand
    Posts
    47

    Talking Unanswered: sql statement

    I want to used the value selected in a combo box to generate a query?

    Select * from MachineTable where Machine_id =(the valuse in the combobox). What part of the query design do i enter this line!

    I have been working in oracle for the last year and my access brain has rusted!!! can anyone direct me to some helpful tutorials-greating forms and reports.

    i would like to use this query as a datasource in word document.

    thank you.
    have a nice day
    Nerdy Girl

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb Re: sql statement

    Originally posted by nerdy_girl
    I want to used the value selected in a combo box to generate a query?

    Select * from MachineTable where Machine_id =(the valuse in the combobox). What part of the query design do i enter this line!

    I have been working in oracle for the last year and my access brain has rusted!!! can anyone direct me to some helpful tutorials-greating forms and reports.

    i would like to use this query as a datasource in word document.

    thank you.
    have a nice day
    Try:
    Select * from MachineTable where Machine_id =Forms!yourFormName!yourComboBoxName.ListIndex

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    not 100% convinced by .ListIndex (tho there are cases where it would work)

    if combo is a numeric value try:
    "Select * from MachineTable where Machine_id =Forms!yourFormName!yourComboBoxName;"

    else: if text
    .....Machine_id ='" & Forms!yourFormName!yourComboBoxName &"';"

    if you are trying to achieve this in the A query design grid (and from your question it looks like you are) then in design grid:
    mouse into the criteria box of Machine_id and hit the magic wand on the main toolbar: navigate through forms, all forms, yourForm and double-click yourCombo

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Nov 2003
    Location
    New Zealand
    Posts
    47
    thank you for you replies then syntax seems to be right but It doesn't return the any records!

    this is my statement

    SELECT *
    FROM [Quotation Machine Specification]
    WHERE (("Quotation Machine Specification.ID")="&[Forms]![GenerateQuotePro1]![combox0]&");

    I have a GenerateQuotePro1 form with the combobox on it.
    I have a MachineQuery with this statement in it. Am i trying to do some impossible!!!!

    I want to create a query based on a value in a combox and use the query as a datasource for a mail merge.
    I'm trying to xchange data from a database to fields in a word document.

    thank you for you help....really appriciate it.
    Nerdy Girl

  5. #5
    Join Date
    Nov 2003
    Location
    New Zealand
    Posts
    47
    Thank you that worked perfectly- i wasn't executing the correct sql staement. But it works now

    However- now i need the query to execute after a choice is made from the combobox. In the afterupdate procedure- what is the code for running a query!

    thank you thank you thank you.
    Nerdy Girl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •