What does =[refresh] do?

freem500

Registered User.
Local time
Today, 23:55
Joined
Apr 23, 2007
Messages
19
I am testing an Access database, where there is a combo box on the form. The OnChange event for the Combo box is set to =[refresh]. What does this mean?

On another note, the form itself has a Commit button, with the following code in the OnClick event:

If Me.Dirty = False Then Exit Sub

Me.Refresh​

Is this button necessary? It appears to work fine without it, but I'm wondering if I'm missing something.

Thanks
 
Right on a combo box
if you have after update x= combobox.coloumn.(0)
x1 = combobox.coloumn.(1)
x2 = combobox.coloumn.(2)

etc

the me.refresh
actual refreshes the selection otherwise it can change just the first line of the comobbox option and leave the rest as the first selection

so me.refesh is actual excalty what is.reselct or rerun the qry/combo
g
 
Also, just as an FYI around Refresh and Requery:
in the Microsoft Access Help File said:
The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.
 
Thanks for that. I should have posted 2 threads, as I had 2 questions really:


Why would you put =[refresh] in the OnChange event and not put Me.Refresh in the code for the OnChange event? I have never seen it before (I'm not very experienced though!)

Does a standard form need a commit button - after all the record is saved when you move on to the next record, and there is nothing to refresh? I am actually testing a database created by someone else, and I know that he is very good with VBA but had limited experience of Access and had some trouble understanding what Access could do without needing to use VBA. Hence my question.

Thanks again
 
I would say that a refresh is probably not needed in your situation. I'm not sure why the refresh would be set in the on change event of the combo, without seeing the whole database to see the context.

But, normally, you would just requery the form (Me.Requery) after a combo selection (AfterUpdate) to change the records selected if the form's recordset is based on the combo selection.

A form doesn't need a commit button, in reality, because as you stated the form saves it automatically when it moves to another record. However, if you wanted to use an unbound form, you would then need a way to get the records in to the database and a commit button would be one way.
 
That's exactly what I hoped you'd say! The form is not unbound, neither is the recordset based on a combo selection (at least not from that particular combo box). I think I'll try and simplify it.

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom