Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

subform exit pauses - multiple tab presses required?

$
0
0
:eek:I'm having such a hard time getting into this form so users can do continuous new entries with out mouse clicks - they need to be able to tab through only.
If anyone can point me in the right direction - I will be most grateful!


:oThe structure for this is a m/f with query record source to pull records that require a new s/f record.
The m/f with query is easy to filter, s/f datasheet with table to enter data. The user pulls all Accounts[ACCOUNT] by Employee[SLU], then a single Account or all to open in the m/f.
Except my problem in there is that it doesn't work as I would like it to when there is more than 1 m/f.........I only want to stay on the s/f for data entry......when I exit the last s/f control(with data or not - it's optional) - go to next m/f in the s/f on a new record first control.
What is happening is I exit the last control to nothing...so I tab again, and again - and it will go to the next m/f in the s/f, but not on the new record..in the first record; and not in the first control..in the last. Frustrating!
This s/f has some code in it to aid in the data entry.....I copy a value from the previous record which works splendidly.

STEP 1: Choose the Employee - SLU from a combo box Combo10. WORKS TERRIFIC!

Private Sub Combo10_AfterUpdate()
cmdMoveAcct2211.Visible = True
cmdCancelSLMNChooser1.Visible = True

End Sub

Private Sub Form_Open(Cancel As Integer)
cmdMoveAcct2211.Visible = False
cmdCancelSLMNChooser1.Visible = False
End Sub


STEP 2: Choose the Account from a combo box cboAccount or leave blank for all: THIS RETURNS THE CORRECT RECORDS IN THE M/F! WORKS TERRIFIC!

Private Sub btncancel_Click()
On Error GoTo Err_btncancel_Click


DoCmd.Close

Exit_btncancel_Click:
Exit Sub

Err_btncancel_Click:
MsgBox Err.Description
Resume Exit_btncancel_Click

End Sub

Private Sub cmdMoveGO_Click()
DoCmd.OpenForm "MoveAcctSTATREG"
End Sub


STEP3: MAINFORM OPENS - I have all the records I need and I am in the subform. WORKS TERRIFIC!
Not alot of code here - just an exit.

Private Sub Command67_Click()
DoCmd.Close acForm, "MoveActiveSLMNChooser"
DoCmd.Close acForm, "MoveAccount2211"
DoCmd.Close
End Sub


STEP4: THE SUBFORM ENTRIES
Here's where the problem lies somewhere in here or I am missing something needed in here........not sure if I should change the events, need to add events:
a.) this starts my new record with a value copied from the previous record....this of course get's it's ID number when I tab or type......works perfectly:
Private Sub Form_Current()

Dim lngID As Long

lngID = DMax("ID", "REGSTAT32511", "ACCOUNT = '" & Me.ACCOUNT.Value & "'")
Me.STATLU.Value = DLookup("STATLU", "REGSTAT32511", "ID=" & lngID)

End Sub

b.) if this is triggering at all...it's only on the first m/f record, and I can't see all records.
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec

End Sub

c.) this is a check I added to be sure the data we want SLU is entered before they continue....works perfectly:
Private Sub SLU2_GotFocus()

If IsNull(SLU) Then
MsgBox "Please Register To Salesman 1 before entering split salesman!"
SLU.SetFocus
Else
SLU2.SetFocus
End If
End Sub


In a review of this code/related code......can anyone assist in helping me fine tune this subform?
Need to:
See all records
Enter one record
Tab out
Into the next m/f s/f on the new (or last?) record
On control named STATNOTES :S

Viewing all articles
Browse latest Browse all 13329

Trending Articles