OnGotFocus property

esskaykay

Registered User.
Local time
Today, 17:25
Joined
Mar 8, 2003
Messages
267
Hello,

I have a question on the form property OnGotFocus. I have a Form-A with at command button that opens Form-B (the Form-A remains open). When data entry is complete on Form-B and it is closed, I want Form-A to update based on what was input on Form-B. I have it working if I code something in Form-A’s OnDirty property. However, this requires something else to be changed on Form-A. I tried placing the OnDirty code into the OnGotFocus property but it does not work.

Maybe this isn’t the function of the OnGotFocus property and as such maybe can’t do what I want but was just inquiring as to its possibility. In most instances it’s not a big issue as usually there will be additional input required on Form-A, but I just thought this would be a nicety.

Here's my CODE:

If Me.Grades = -1 Then
If Me.Request_No > 0 Then
Me.txtRequest_No.Visible = True
Me.cmdGrdRequest.Visible = False
Else
Me.txtRequest_No.Visible = False
Me.cmdGrdRequest.Visible = True
End If
Else
If Me.Request_No > 0 Then
Me.txtRequest_No.Visible = True
Me.cmdGrdRequest.Visible = False
Else
Me.txtRequest_No.Visible = False
Me.cmdGrdRequest.Visible = True
End If

Me.cmdGrdRequest.Visible = False
End If

DoCmd.RunCommand acCmdSaveRecord
DoCmd.RepaintObject



Thanks,
SKK
 
Forms in Access can only receive focus (i.e. fire the OnGotFocus event) if there are no controls on the form that can receive focus! In other words, for a form to receive focus, it either has no textboxes, comboboxes, checkboxes, etc. or they're all disabled.

To have code triggered when you return to FormA you need to place it in FormA's Form_Activate() event.
 
I think that did it. I'm seeing a few other issues now but I think I can get through this.
Very much appreciated...

Thanks again,
SKK
 

Users who are viewing this thread

Back
Top Bottom