Updating field (with Requery? other methods welcome)

a_ud

Registered User.
Local time
Today, 13:04
Joined
Mar 5, 2011
Messages
16
Help needed, as I don't get a field to update on a form. The structure of my form is:

Form F1 (populated by On load event that reads a SQL server database)
The form includes 3 tabs: T1 | T2 | T3

T1 includes the field to be updated, let's call it "State" (it's a combo).

I'd like either:

  • Whole tab T1 to update (requery?) when a button is clicked on T3 (this button changes the value of the field State in a SQL server table).

  • Or just the "State" combo box in T1 to requery (to 'update') when a button is clicked on T3.
I've tried this through code (Refresh, Requery) on the click event of the button, but something is missing because it doesn't update.

I'm looking for the general command/code (Refresh/Requery/ Other) that updates either a form, a tab in a form, or a control in a tab. Thanks in advance, a.
 
I've tried this through code (Refresh, Requery) on the click event of the button, but something is missing because it doesn't update

Can you post the code you've tried? A .Requery is all you should need but you may be using it incorrectly. No way for us to know without seeing your code.
 
Fair enough.
The code that populates the form is:
Code:
Set rs1 = New ADODB.Recordset
With rs1
    Set .ActiveConnection = oConn
     .Source = SQL
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .Open
    .ActiveConnection = Nothing
End With
Set Me.Recordset = rs1

Basically gets some info from SQL Server and populates the form fields, that's all. I think you're right in that I might be using Requery the wrong way. Now the main questions are:

  • Can Requery be used on this 'code-populated' form?
  • If yes, can it be used on a whole tab, or just on a control?
  • If just on a control how would it be called?
Thanks in advance, a.

Can you post the code you've tried? A .Requery is all you should need but you may be using it incorrectly. No way for us to know without seeing your code.
 

Users who are viewing this thread

Back
Top Bottom