Danielbryanuk
Technical User
Hi there,
I am building a database and have a query about refreshing data in a form.
The form is based on a table (say TBLX), and has only one control which is a field from the source table (say DATAX). The data in this field is the same for all records in TBLX, so I decided to base the form on the table rather than creating a query for it.
I run a number of macros from the form using other command buttons. One particular macro updates all the data in TBLX, by way of deleting all the table contents first, then appending new data from a holding table. I chose this method instead of importing directly to TBLX as I didn’t know how to overwrite data using the 'get external data' menu function, or the 'transfer...' macro action. Either way I figured I would have to delete TBLX before updating it.
The problem is that after updating TBLX the form control that is meant to display DATAX only shows “#Deleted”. I have tried running a ‘requery’ and ‘repaint’ as part of the macro (after the new data is appended), and have tried using a ‘refresh’ control on the form itself (using the command button wizard). Each method fails to update the control. The control is updated when you close and open the form, but I don't want to do this.
It is important to refresh the control as it is referenced in the next macro I use (it is part of a condition on the macro to control the flow etc.) In this case the evaluation of the condition is incorrect.
What do you think the problem is?
Many thanks for your help.
Dan
I am building a database and have a query about refreshing data in a form.
The form is based on a table (say TBLX), and has only one control which is a field from the source table (say DATAX). The data in this field is the same for all records in TBLX, so I decided to base the form on the table rather than creating a query for it.
I run a number of macros from the form using other command buttons. One particular macro updates all the data in TBLX, by way of deleting all the table contents first, then appending new data from a holding table. I chose this method instead of importing directly to TBLX as I didn’t know how to overwrite data using the 'get external data' menu function, or the 'transfer...' macro action. Either way I figured I would have to delete TBLX before updating it.
The problem is that after updating TBLX the form control that is meant to display DATAX only shows “#Deleted”. I have tried running a ‘requery’ and ‘repaint’ as part of the macro (after the new data is appended), and have tried using a ‘refresh’ control on the form itself (using the command button wizard). Each method fails to update the control. The control is updated when you close and open the form, but I don't want to do this.
It is important to refresh the control as it is referenced in the next macro I use (it is part of a condition on the macro to control the flow etc.) In this case the evaluation of the condition is incorrect.
What do you think the problem is?
Many thanks for your help.
Dan