open form to Add New record not working

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

Hello
From the form I'm in, (for table 1) I'd like to open another form (for table
2), to immediately add a new record for that table.
But the code I thought i needed to enter 'acNewRec' isn't working. I
don't want to put the property for form 2 in Data Entry "Yes" because I want
to be able to open that form from the menu and have all records show.

Please can someone tell me why?

Private Sub cmdAddFolder_Click()
On Error GoTo Err_cmdAddFolder_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmFolderDetails"
DoCmd.OpenForm stDocName, , , acNewRec

Exit_cmdAddFolder_Click:
Exit Sub

Err_cmdAddFolder_Click:
MsgBox Err.Description
Resume Exit_cmdAddFolder_Click

End Sub

Thank you
Jen
 
Jen,

Try this line and see if that does the job:

DoCmd.OpenForm stDocName, , , , acFormAdd

hth
 
Back
Top