Go to next field on form after running code in previous field

N

nadine

Hi,

Can any one help me. When I open a form the user must entry information into
same . When it comes to a field I need it to run code which is working fine
my problem is that I want the tab to return to the next field once it has run
the code.

Code attached.

Any thoughts


Thanks
--
Nadine
Private Sub A_C_Exit(Cancel As Integer)
DoCmd.GoToRecord acDataForm, "Frm_Members Details", acNext
DoCmd.GoToRecord acDataForm, "Frm_Members Details", acLast
DoCmd.OpenQuery "Qry_Bank Validation delete temp"
DoCmd.OpenQuery "Qry_Bank Validation test 1"
DoCmd.OpenQuery "Qry_Bank Validation test 2"
If DLookup("FlagBank", "[Tbl_Temp Account Validation]") = 1 Then
DoCmd.OpenQuery "Qry_Bank Validation test 3 90"
DoCmd.OpenQuery "Qry_Bank Validation test 4 90"
DoCmd.OpenQuery "Qry_Bank Validation test 5 90"
DoCmd.OpenQuery "Qry_Bank Validation test 6 90"
DoCmd.OpenQuery "Qry_Bank Validation test 7 90"
DoCmd.OpenQuery "Qry_Bank Validation test 8 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 3 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 4 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 5 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 6 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 7 90"
DoCmd.Close acQuery, "Qry_Bank Validation test 8 90"
DoCmd.OpenForm "Frm_Bank Validation test 9 90"
ElseIf DLookup("FlagBank", "[Tbl_Temp Account Validation]") = 2 Then
DoCmd.OpenQuery "Qry_Bank Validation test 3 93"
DoCmd.OpenQuery "Qry_Bank Validation test 4 93"
DoCmd.OpenQuery "Qry_Bank Validation test 5 93"
'MsgBox "test complete"

Else
MsgBox "test incomplete please check Sort code and bank number"

End If
End Sub
 
T

Tim Ferguson

When it comes to a field I need it to run code which is working fine
my problem is that I want the tab to return to the next field once it
has run the code.

If you don't want the user to do anything in the control, make it
Locked=True and Enabled=False, and trap the GotFocus event of the next
one instead.

Or use the OnCurrent event of the form and just do the calculations up
front.

Or use teh BeforeUpdate event of the form and do it before committing any
data anywhere.

What you have to think about is that the Windows Way no longer supports
forcing the user to move around a form in any particular order. Any
dialog box or form in any windows application will allow you to access
any control in any form. When something absolutely has to follow a
special order, then a Wizard is likely more appropriate.

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top