Question : update query in access 2003 possible

hi.
Have an access 2003 db.  I would like to run a update query ( In the onclick event of a cmdbutton1) The subform that I am targeting is based on a query.  This query list:
 Itemname |CountofItemname| Status|  and is grouped on itemnames and status has a criteria of In-Hous.  SO basically, it groups all items in inventory with same status and gives the total for each group.  

That being said.  I have a cmdbutton1 on the main form.  Each time it is pressed, i would like
an update query to run changing the status of the record selected on the subform from In-House to "Off-site".  Problem is I only want it to change 1, lets say the first record in the group, not the status of the whole group.  Is it possible to run an update query and change only the first record that matches your criteria not them all?  Thanks.

Answer : update query in access 2003 possible

In that case, an update query might not be the easiest solution, unless you have additional criteria to determine which one of the group you want to update...

Using VB, you can create a query to select records from the group, open it as recordset, and update the first record. The code below is just a template to illustrate the idea.

(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
strSQL _
    = " SELECT * FROM Table1" _
    & " WHERE Status = 'In-House'" _
    & "   AND Itemname = '" & subFormName.Itemname & "'"
With CurrentDb.OpenRecordset(strSQL)
    .Edit
    !Status = "Off-site"
    .Update
End With
subFormName.Requery
Random Solutions  
 
programming4us programming4us