Results 1 to 5 of 5
  1. #1
    senghlim is offline Novice
    Windows Vista Access 2003
    Join Date
    Oct 2010
    Posts
    6

    An expression to edit a single row

    Hello,

    I have created form that's laid out like a Datasheet. Each cell is in the format of a drop down box.



    I want it such that when you update one of the cells to the letter A, some of the other cells in the SAME ROW change too.

    At the moment I have made a macro that stores a temporary variable that represents the current row being edited. this is called CurrentID.

    So far, I've made it so that when a cell is changed, i have managed to make it such that the other cells in the same row are edited by using an update query that contains a criteria saying "only update if ID = CurrentID"..

    HOWEVER, the update query runs when ANY cell in the current COLUMN (or FIELD) is the letter A.

    How do i write an expression condition to say "only run this query when the value in the specific ROW is changed to A?"

    Thanks. If you have any questions please ask

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    In a continuous form, code that is outside a forms' line/row control will affect all rows because all rows share the same control name. To limit action to just the one line, one must put the code at the row level control - generally the AfterUpdate or Exit event.

    Hope this helps.

  3. #3
    senghlim is offline Novice
    Windows Vista Access 2003
    Join Date
    Oct 2010
    Posts
    6
    Yes i've realised this thanks. However do you know what the row level control is? I'm trying to work out code to put in the "Condition" column when making a macro. At the moment the "Action" is OpenQuery, where the Query is the query that updates the desired row to the the desired value...

    However the only problem is the "Condition", need row control in this column.

    Thanks, sorry a bit of a newbie

  4. #4
    senghlim is offline Novice
    Windows Vista Access 2003
    Join Date
    Oct 2010
    Posts
    6
    Sorry i mean "...do you know what the row level control code is?"

    Like how do i say (for example) "Change everything from field 'Price' that has an ID of '5' " , where price is the name of the field and ID is the primary key

  5. #5
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    in a continuous form; one would have, in design view, one set of controls. but when in data view it will be continous rows.

    code that is up in a higher level object, like a form Current event, or in a module - that refers to a control will affect all rows in data view.

    code that is in a control, such as one of the text boxes's AfterUpdate event will only affect that row.....depending of course on what that code says....

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

Similar Threads

  1. Database Won't Open To Edit??
    By dapoole in forum Access
    Replies: 2
    Last Post: 10-04-2010, 07:56 AM
  2. how to edit listboxes?
    By RedGoneWILD in forum Programming
    Replies: 2
    Last Post: 08-23-2010, 11:53 AM
  3. edit combobox
    By nako in forum Database Design
    Replies: 1
    Last Post: 06-23-2010, 05:56 AM
  4. Cannot not edit form
    By stingray_69 in forum Forms
    Replies: 3
    Last Post: 03-18-2010, 10:49 AM
  5. Allow some users to edit, and other to only view?
    By Tommy1005 in forum Security
    Replies: 2
    Last Post: 11-09-2009, 09:33 AM

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