Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2010

    Unanswered: Subform current on new record

    Looking for some help expanding this bit of code..........I need help with 2 things-

    I have my m/f (MoveAcctSTATREG) return a filtered set of records. m/f has s/f (MOVEREG) that will have 1 or more record.
    Since nothing is being entered or changed in my m/f - I set focus to the s/f with this in the m/f code:
    Private Sub Form_Load()

    End Sub

    there is something strange where the first m/f doesn't show me all my s/f records, just a new record. Subsequent s/f's have all records and Form_Current code is triggered.
    [/S1.) How do I get focus on the subform in a new record on specific control? see below

    What this s/f code does is create a new record that copies the value of one control in the last record....leaving 4 controls to be filled in STATNOTES, SLU, SLU2 and RNOTES (STATNOTES, SLU2 AND RNOTES Optional)
    Private Sub Form_Current()

    Dim lngID As Long

    On Error GoTo Err_Form_Current

    lngID = Nz(DMax("ID", "REGSTAT32511", "ACCOUNT = '" & Me.ACCOUNT.Value & "'"), -2147483648#)

    If lngID = -2147483648# Then
    MsgBox "Cannot find this Account!", vbCritical, "Help!"


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

    End If

    Exit Sub

    MsgBox "An error has occured: " & vbCrLf & Err.Number & " - " & Err.Description, vbCritical, "Something needs fixing"

    End Sub

    the control where I need the focus is STATNOTES, SLU is required field. Which works ok since the other controls before it are not tab stops - but i can't get it on the new record
    2.) When I enter the data in (my last control on s/f) RNOTES, I don't want to go to the next s/f record. That will create data errors in what I am trying to accomplish with the form current code here. I need to go to the next m/f, with focus set to s/f new record on control SLU.

    The goal is to click through each m/f, updating the 4 controls of s/f and then on to the next m/f until done or exit. Ideally without mouse, just tabbing through. There can be many m/f's returned - 85 - 200.

    Right now I do not have an exit from the s/f, if I tab out of RNOTES nothing happens. I have no cursor and am not sure where focus is. If I use the record selector to go to the next m/f record, I am in the s/f on the same control I left off in the previous s/f.

    The records are being saved when I go to the next m/f

    I have attached a picture for visual......

    Any suggestions greatly appreciated! :-)
    Last edited by Foskbou; 10-20-12 at 12:56.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts