Open form go to new record

cardgunner

Registered User.
Local time
Today, 05:12
Joined
Aug 8, 2005
Messages
210
I just upgraded to Access 2007. When in 2003 I would open a form and it would go the a new record but the form was not filtered. Now when I open the form it filters it.

my Open event procedure is

Private Sub Form_Open(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_call_log_table"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
DoCmd.GoToRecord , , acNewRec

End Sub

What do I need to do so when the form opens it goes to the new record but does not filter it?
 
One, why are you including stLinkCriteria when there's no criteria? That makes no sense.
 
That is what the command button wizard set. I went in after that and added the command to go to the new record.
 
That is what the command button wizard set. I went in after that and added the command to go to the new record.

Try pulling it out and see if that helps at all. Also, the form doesn't have its DATA ENTRY property set to YES, does it?
 
The data entry is set to no.

when I take out stLinkCriteria and leave that line like
DoCmd.OpenForm stDocName, acFormDS, ,
I get a compile error Syntax Error
 
The data entry is set to no.

when I take out stLinkCriteria and leave that line like
DoCmd.OpenForm stDocName, acFormDS, ,
I get a compile error Syntax Error

When you have no parameters in there you don't leave the commas after the last item. So remove the last two commas to make it:

DoCmd.OpenForm stDocName, acFormDS
 
I did that as well and got the same error.

I appreciate your help Bob but I had a saved filter and I went in somehow and deleted the filter or something but it works now. This is the issue with upgrades...you never know where the heck things are.

Thanks again.
 
And this one line will open the form and create a new record:

DoCmd.OpenForm stDocName, acFormDS, , ,acFormAdd
 

Users who are viewing this thread

Back
Top Bottom