Results 1 to 8 of 8
  1. #1
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176

    Trying to run a query with input from a form, query works fine but the form doesn't

    I have a simple multifield search form. 2 unboud text boxes and a button to run the query.


    What is happening is that it only runs the query and assumes the the input is * so all the data shows up.
    I set the defualt value of the text input box as "" but when I type anything in the query still shows everything
    Am I missing some way to link them?

    I know that this is the problem becuase when I open the query without the form and I input the values asked for (format: [Forms]![Search]![CONum]) it works perfectly so somehow what I type into the form doest get transmitted.

    I'm sure I'm missing something simple,
    Thanks!

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    try a requery after you input on the form.
    Dale

  3. #3
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    I tried that, I also close the query before hitting 'run query' in the form so that should be along the same lines?
    It's like the 2 textboxes are being completey ignored.

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Please copy and paste your SQL for you query.


    Dale

  5. #5
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Here it is:

    SELECT co.ControlNumber, co.ContractNumber
    FROM co
    WHERE (((co.ControlNumber) Like [Forms]![Search]![ChangeOrderNumberB] & "*") AND ((co.ContractNumber) Like [Forms]![Search]![ProjectNumberB] & "*"));

  6. #6
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Code:
    WHERE co.ControlNumber) =  [Forms]![Search]![ChangeOrderNumberB] ;
    This is assuming that you form name is Search, and that ControlNumber and ChangeOrderNumberB are numbers.

    Dale

  7. #7
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    I don't get it should I replace what I had with your new code?

    Control Number and ChangeOrderNumberB are both numbers

    ContractNumber and ProjectNumbB are both text, does that mean I have to do something different?

    Thanks!

    Edit: I figured out I was putting in the label name instead of the text box name, but know while I get the numbers that I need, I get them an infinate amount of times so that access has to stop running the query because it exeeds 2gb. What in the world? I literally only changed the name

    Edit2: Nevermind, its works now, thanks!

  8. #8
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Try this,

    Code:
    WHERE ((co.ControlNumber = [Forms]![Search]![ChangeOrderNumberB]) AND ((co.ContractNumber) =  [Forms]![Search]![ProjectNumberB]));
    Replace you WHERE clause with this.

    Dale

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-19-2012, 03:23 AM
  2. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  3. input form from query
    By Nixx1401 in forum Forms
    Replies: 6
    Last Post: 10-02-2012, 07:54 AM
  4. Run a query based on an input from a form
    By apoorv in forum Queries
    Replies: 4
    Last Post: 07-11-2011, 01:39 PM
  5. Form doesn´t update with Query.
    By disturbedgod in forum Forms
    Replies: 10
    Last Post: 02-09-2010, 02:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums