Losing focus in a form

octatyan

Registered User.
Local time
Today, 09:00
Joined
Jan 10, 2003
Messages
36
Hi I need some help on a forms issue...

I have a form that displays people's information (for an address book). It displays only the persons name and phone numbers.

This form displays only one person's record at a time.

This form also has a subform that allows a user to add more phone numbers to the current record that is displayed.

In the subform, I have a text field called phone number which is "not enabled". To enable it, you must click the "add number" button.

Here's my problem:
After clicking "add number", the phone number text field in the subform is now enabled. but if the user decides to move to another record (person), the phone number text field in the subform is still enabled. How do I make it so that if the user moves out of the subform (loses focus), the text field is unenabled again?
 
How are you synching your subform to your main form? Are you using the Link fields?
 
hmmm...I have no idea. I actually don't even know what you're talking about =(

When I add a subform, I use the wizard and basically I use all the default values.

The form and subform are linked by a common field. Does that answer your question?
 
Put this code in the lost focus event of the phone number control on your subform

Private Sub phone number_LostFocus()
Me.ANOTHERCONTROL.SetFocus
Me.phone number.Enabled = False
End Sub


IMO
 
ok, but now what if i have 10 text boxes on that form? How would I go about accomplishing the desired task now?
 
You could try setting "locked" to yes for the subform object.

Your command button could then unlock the subform.

In order to relock the subform, use the "on exit" event of the subform to set locked to yes.

eg:

Code:
Private Sub CommandButton_Click()
Me.SubformObjectName.Locked = False
End Sub

Private Sub SubformObjectName_Exit(Cancel As Integer)
Me.SubformObjectName.Locked = True
End Sub

HTH

Brad.
 
Problem with Screen resolution on Forms

Hi,
I'm almost done with my access database but when I installed it to two of the computers at my work, the forms spilled over the screen borders. In other words, some of the fielt and bottons are not showing on the screen. All the bottons and fonts are also larger than the usual size and they are faded out. I tried to re-adjust the screen resolution on the two computers, but the settings didn't allow me to go higher than (1024x760). My screen resolution is (1400X1050). how do I go about fixing this problem? Please help! I will be checking the mail every 60 min.

Thank you,
B.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom