Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2013
    Posts
    82

    Unanswered: Command Button Code for New Record

    I have a form with a command button that is currently using a macro. Sometimes it opens a new record but not always.

    I would like to alter the button to use code instead to see if it corrects the inconsistency.

    So I would like to have code to open a new record and start the cursor in a selected field 'AFRNumber'.

    The form is called 'Workorder'.


    Does anyone have a suggestion?

    Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    are you using bound controls, if so do you have the navigation buttons on the bottom part of the form..... if so press the * button
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Aug 2013
    Posts
    82
    I hid the navigation buttons because the techs were typing over other records.

  4. #4
    Join Date
    Aug 2013
    Posts
    82
    On Current:

    Private Sub Form_Current()
    If Me.CloseWorkOrder = True Then


    Me.AllowDeletions = False
    Me.WorkorderParts.Form.AllowAdditions = False
    Me.WorkorderParts.Form.AllowDeletions = False
    Me.AllowEdits = False
    Me.WorkorderParts.Form.AllowEdits = False

    Else

    Me.AllowDeletions = True
    Me.WorkorderParts.Form.AllowAdditions = True
    Me.WorkorderParts.Form.AllowDeletions = True
    Me.AllowEdits = True
    Me.WorkorderParts.Form.AllowEdits = True

    End If
    End Sub

    **************

    On Load:

    Private Sub Form_Load()
    Me.AFRNumber.SetFocus
    End Sub

  5. #5
    Join Date
    Aug 2013
    Posts
    82
    I found what I was looking for:

    DoCmd.GoToRecord , , acNewRec

    I placed this in the on_click of the button.

Posting Permissions

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