Button after update change focus

C

ChadMan

I have a button "SaveSN" that saves my record. I'd like it to do 2 more
steps. goto a new record and set the focus to the original text input box.
Can I insert the lines in the SaveSN button code below or do I make another
"Private Sub" command like SaveSN_AfterUpdate?

If I can insert it, where should I do so in the code below? Before the
Exit_SaveSN_Click line?

<code>

Private Sub SaveSN_Click()
On Error GoTo Err_SaveSN_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_SaveSN_Click:
Exit Sub

Err_SaveSN_Click:
MsgBox Err.Description
Resume Exit_SaveSN_Click

End Sub

</end code>

TIA if you can help
ChadMan
 
C

ChadMan

Another question is (can I pile them up? :( or is that bad?) can I create a
filter for my date input text box so that all they have to do is type 6
numbers: mmddyy and have it put the "/" in for me?
 
U

UpRider

Chadman, see the 2 new lines of code below, naming your form and control
appropriately.

UpRider

ChadMan said:
I have a button "SaveSN" that saves my record. I'd like it to do 2 more
steps. goto a new record and set the focus to the original text input box.
Can I insert the lines in the SaveSN button code below or do I make another
"Private Sub" command like SaveSN_AfterUpdate?

If I can insert it, where should I do so in the code below? Before the
Exit_SaveSN_Click line?

<code>

Private Sub SaveSN_Click()
On Error GoTo Err_SaveSN_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'Add these two lines of code here:

DoCmd.GoToRecord acDataForm, "frmYourForm", acNewRec
DoCmd.GoToControl "YourControl"
 

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