If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How set focus to sub form?
I have a form and a subform with a one-many relationship. Before I exit the
form, I must validate that there is at least one row in the subform. Is there an easy way to do this? Also, if there is no row, I display a msgbox and then need to set focus to the subform, how? I tried the syntax in my Access book and it does not work. Here is what I used: Me.Controls("frmCorrespRuleXref_subform").Form.Con trols("Chapter").SetFocus |
#2
|
|||
|
|||
On the unload event of the form write the code
' To check if any records were entered If Me.SubFormName.Form.RecordsetClone.RecordCount = 0 then cancel=true ' Wont let exit the form me.SubFormName.Form.FieldName.SetFocus ' Set the focus to the field exit sub End if -- I hope that helped Good luck "mscertified" wrote: I have a form and a subform with a one-many relationship. Before I exit the form, I must validate that there is at least one row in the subform. Is there an easy way to do this? Also, if there is no row, I display a msgbox and then need to set focus to the subform, how? I tried the syntax in my Access book and it does not work. Here is what I used: Me.Controls("frmCorrespRuleXref_subform").Form.Con trols("Chapter").SetFocus |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combo Box NotInList - How To Add Data To Underlying Table | 10SNUT | Using Forms | 19 | July 8th, 2005 09:12 PM |
Moving focus from sub form to main form | Robin Chapple | Using Forms | 2 | June 11th, 2005 09:50 AM |
Is it possible to show both "Yes" and "No" answers from a "yes/no" checkbox? | Colin Foster | New Users | 28 | March 18th, 2005 02:19 PM |
printing label for record that has focus on the form | babs | Setting Up & Running Reports | 0 | February 4th, 2005 06:01 PM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |