duplicate record & requery problem

paulhenley

Registered User.
Local time
Today, 16:00
Joined
Apr 16, 2002
Messages
23
I have a form that has a "duplicate record" button which allows the user to copy a selected item and create a new record. This works well and even selects the next item number when adding the copied record.
All was OK until I added a requery command on controls that appear later in the form. There are many calculated fields in the form along with key fields that are included in the calculations.
I have tried to find an alternative to requery (including repaint etc) but none recalculate correctly when data is changed.
If I remove this requery command and use the "duplicate record" the form adds a new item with the next number. If I reinstate the requery command and try to use the "duplicate record" the form tries to create a copy but then gives an error because the item number does not increment (it's the same as the item I am copying and hence - duplicate value in an indexed field).
Please can anyone help?
 
If your calculations are done at form level, use the Refresh command (Unless you are requerying a combo). Make sure that the refresh is not processed until the new record has been created. I presume that when you press the duplicate record button, a new record opens with 'default values' copied from the previous record. I think this info will not be committed and a new record created until you enter other new data ( I may be wrong on this)
Have a look at when you are running the requery/refresh command and only run it when an update has been committed but also look at if is absolutely necessary to duplicate info.

HTH
 

Users who are viewing this thread

Back
Top Bottom