open form to Add New record not working

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
 
M

Maurice

Jen,

Try this line and see if that does the job:

DoCmd.OpenForm stDocName, , , , acFormAdd

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top