Question : Requery needed when adding records, but not when Editing - causes problem with Continuous form used to select records

I have a continuous form with records listed for a particular consignor. This continuous form has information that would allow the user to identify records to Edit, but also that they might need to add (missing) items. So they have ADD and EDIT buttons on the continuous form. To Edit they first click on the record they want to edit.

Once they select what they want to do, a more complete form opens which they can fill out more information on the item.

If they have selected Add I use "requery" (in VB) under the Save button, so that the continuous form is updated once they exit the complete form and go back to the continuous form and the new record is added to the continuous form.

If they select a record for edit but do not click Save button (they do not make changes, just Exit), once they exit  back to the continuous form, the pointer is on the record they had previously selected.

But if they click on the Save button, when they exit and go back to the continuous form, it moves them to the top of the list and not pointing to the record they had selected for editing.

They may be going from one record to another to check things and want to be on the continuous form on the last record they worked on and not have to go down from the top to get to the next record to check.

Question: How can I do Requery for Add and not for Edit even though I am using the same form for each.

Answer : Requery needed when adding records, but not when Editing - causes problem with Continuous form used to select records

try check ing if the form is in newrecord

private sub cmdsave_click()

if me.newrecord then
    ' do your rquery
end if

end sub
Random Solutions  
 
programming4us programming4us