oh my - it doesn't look like my post is here.!
It's subform and mainform
here's the post:
Thanks for checking my post! Looking for some help on this scenario -
My mainform opens from a dialog box and can return a single chosen record or several records.......
Each m/f has a s/f in which a new entry is going to be made. Every s/f
already has one or more records. The focus is set to the s/f and the
s/f uses a DMAX Form_Current to copy a value from it's previous record.
That's all well and good working. Although, I think I am missing
something in the Form_Current because even though it does allow me to go
through my other controls, it won't let me out. I tab out of the last
control and nothing happens.
What I am trying to do is exit out of my last s/f control back to my
m/f...I have an Exit button there cleverly called Command65...I want to
use that button to see of there is a next m/f record. If there is, I
want to go to the next record and loop through again s/f entry, exit to
m/f, s/f entry, exit to m/f by using the tab key.
The button should also allow the user to click and close the m/f if they
are not going to finish updating each of these at this time.
Here is the code I have now......
SUBFORM = MOVEREG
**this is where I seem to be stuck in the s/f -
not sure if I have properly closed the error handling and exiting. FYI:
This "error" is bogus since I will always have records returned to
me**
Private Sub Form_Current()
On Error GoTo Err_Form_Current
Dim lngID As Long
lngID = Nz(DMax("ID", "REGSTAT32511", "ACCOUNT = '" & Me.ACCOUNT.Value & "'"), -2147483648#)
If lngID = -2147483648# Then
MsgBox "Cannot find this Account!", vbCritical, "Help!"
Else
Me.STATLU.Value = DLookup("STATLU", "REGSTAT32511", "ID=" & lngID)
End If
Exit_Form_Current:
Exit Sub
Err_Form_Current:
MsgBox "An error has occured: " & vbCrLf & Err.Number & "
- " & Err.Description, vbCritical, "Something needs fixing"
Resume Exit_Form_Current
End Sub
Private Sub SLU2_GotFocus()
**this triggeres as expected**
If IsNull(SLU) Then
MsgBox "Please Register To Salesman 1 before entering split salesman!"
SLU.SetFocus
Else
SLU2.SetFocus
End If
End Sub
Private Sub RNOTES_Exit(Cancel As Integer)
**this doesn't do anything at all - I have no cursor, no focus**
Me.Parent!Command65.SetFocus
End Sub
MAINFORM: MoveAcctSTATREG
Private Sub Command65_Click()
DoCmd.Close acForm, "MoveActiveSLMNChooser"
DoCmd.Close acForm, "MoveAccount2211"
DoCmd.Close
End Sub
Private Sub Command65_GotFocus()
**I'm not sure about this yet b/c I haven't been able to get the Focus here from the subform**
DoCmd****nCommand acCmdSaveRecord
If CurrentRecord - RecordsetClone.RecordCount Then
DoCmd.Close acForm, Me.Name
**this is intended to close the entire thing down if I open a single m/f records(which my dialog box gives me the option to do**
Else
DoCmd.GoToRecord , , acNext
End If
End Sub
Private Sub Form_Load()
**This triggers okay, and I need it to do the
same if I am in the next record, too.....I haven't got there yet. Will
Load trigger for each m/f, or do I need to start with Open and also put
in Load or Activate**
Forms!MoveAcctSTATREG!MOVEREG.SetFocus
End Sub