View Single Post
 
Old 02-16-2017, 03:08 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 53
Default

Thanks for your help.

Yes, the form is disabled during an update to a database to prevent any user interaction while this takes place. It may or may not be disabled when refreshfields is called.

I've had another look and now have it calling Refreshfields successfully (not sure what I did though).

There was still an issue with Refreshfields which I found was due to:
  1. My controls being in Groupboxes so I found I had to iterate the controls in each Groupbox separately.
    Code:
            For Each ctrl In Me.Controls
                If TypeOf ctrl Is GroupBox Then
                    For Each ctrl2 In ctrl.Controls 'iterate through each control in Gbox
  2. The Typeof .... IS was not successfully identifying the controls so the associated resettext etc was never executed. I'm not sure why this didn't work but I changed to using GetType which does.
    Code:
    'Didn't work
                        If TypeOf ctrl2 Is TextBox Then
                            ctrl2.Text = vbNullString
                        End If
    'Does work
                        If ctrl2.GetType() Is GetType(TextBox) Then
                            ctrl2.Text = vbNullString
                        End If
Reply With Quote