Results 1 to 6 of 6
  1. #1
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40

    Update data using query

    Hi I have some problem to execute one query.



    Actually I have a table and there i have 100 rows. and in forms I have one txtbox. Now If i update 10 in that txtbox automatically first 10 rows update with values means If i put any number in that txtbox the same number of row should update in table.

    Please guide me to solve this prob. Thanks in advance...

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Need to clarify:

    You have a table with 100 records - clear

    You have a form with a textbox - ok (a bit like saying i have a car with wheels)

    If you put 10 in the textbox your first 10 rows update with values. Does this mean they appear on screen, or that you actually want to run an update query of some desctiption?

    If you put any number in that text box the same number of rows should update in the table - What are you trying to update? is it not updating the correct number of rows?

    If you can make it a bit clearer what you want to achieve and what your problem is we can probably help a bit more.

    It may also help if you can upload your project for people to look at:

    Strip out any confidential information, put in a few sample dummy entries so we can get the idea of what you have and are trying to do, then compact and repair, zip if it is still large, and attach an mdb if it wont break it as many people like myself can't open accdb formats .

  3. #3
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40
    hi,
    My table is like this,
    table
    task name
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10



    and another table emp

    name
    a

    so in form if I put 5 then first 5 task it goes to a or if I put 10 then all 10 task goes to a. Now I need to run a query for that. Can you Please help me on that..

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Your post is not clear.

    so in form if I put 5 then first 5 task it goes to a or if I put 10 then all 10 task goes to a. Now I need to run a query for that. Can you Please help me on that..
    Please provide clearer description.
    Please show us the SQL for your query.
    Please show a sample output of your query.

  5. #5
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40
    Ok I will update the problem again....


    Actually I have 2 tables. One is task and another is user.
    In task table we have 2 column
    1.Task_name
    2.user

    The another table we have one column
    1.user_name

    I have one form and there I have one textbox, one commendbutton and a combobox

    Now if I select a username in combobox and put 5 in a textbox and press the cmdbutton the result should update as first 5 task belongs to selected user.
    as on if i change the textbox value it should update the same number of task for that user.


    Thanks...

  6. #6
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Just check if below gives some guidelines :
    Code:
    UPDATE 
        tblTasks 
    SET 
        tblTasks.[User] = "b"
    WHERE 
        tblTasks.Task_Name 
        IN 
        (
            SELECT TOP 3 
                tblTasks.Task_Name 
            FROM 
                tblTasks 
            WHERE (((tblTasks.User) Is Null)) 
            ORDER BY tblTasks.Task_Name 
    );
    Thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  2. Replies: 1
    Last Post: 08-19-2011, 12:16 PM
  3. Update query with sum data
    By Lorlai in forum Access
    Replies: 7
    Last Post: 07-15-2011, 02:48 PM
  4. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  5. Update Query: Modifying Data Using Top Values
    By William McKinley in forum Queries
    Replies: 1
    Last Post: 11-30-2010, 02:20 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