Refreshing single form control (1 Viewer)

mrazanaqvee

New member
Local time
Today, 01:22
Joined
Jun 21, 2016
Messages
6
Can someone help me understand refreshing a single control on a form? :banghead:
1) Is it even possible?
2) If possible whats the concept and syntax

I have tried various suggestions but these were usually hit and miss. A single field in a form changes frequently and refreshing the whole form takes too long.

Many thanks
mrazanaqvee
 

Ranman256

Well-known member
Local time
Yesterday, 20:22
Joined
Apr 9, 2015
Messages
4,337
you mean 1 control, like a combo box, or text box?
to refresh a combo box list, that had something added but isn't showing:
cbobox.requery

this will refresh the control.
There is also a button on the toolbar, refresh all.
but that updates ALL the controls.
 

mrazanaqvee

New member
Local time
Today, 01:22
Joined
Jun 21, 2016
Messages
6
Apologies for the very delayed response. Yes, the simple ControlName.Requery will work for most scenarios but doesn't for me. Here is the context:

1) Continuous form which gets data from a query built on two tables. Left Join table is read only so cannot change records on the form.
2) Users go through each record and record each as been 'Actioned' by clicking the Toggle button to a Yes state
3) Clicking a single record to a Yes state also changes every other record in the recordset on the form to a Yes state irrespective of underlying values (since the form is continuous).

This is my workaround:
Since its a read-only form, instead of toggle buttons Click event, I have put code in place under GotFocus event which does this:
i) Checks for toggle buttons current value with VBA and reverses the value (0 to a -1, -1 to a 0) directly in the table (other table in the query which I have write access to)

I now need to refresh the toggle button. I can achieve this by either refreshing or requerying the whole form but that takes toooooooo long. Is there a way to refresh just the toggle button?

Dim ctlTgl As Control
Set ctlTgl = Status
DoCmd.Requery ...

I have tried various syntaxes but have not been able to make it work. Does it work? Anything else I can try?

Any suggestions?
 

Users who are viewing this thread

Top Bottom