Filter on New Record

gschimek

Registered User.
Local time
Today, 05:22
Joined
Oct 2, 2006
Messages
102
How do I have a button open up a form that filters so that only a "New" record is used as the record source? Right now I use this code to create a directory based on a record:

Code:
Private Sub Form_Close()
Dim strDirectoryPath1 As String
strDirectoryPath1 = CurrentProject.path & "\accounts\" & CompanyName

If Len(Dir$(strDirectoryPath1 & "\.", vbDirectory)) = 0 Then
MkDir (strDirectoryPath1)

End If
End Sub

That code works fine if I'm filtered and looking at just the record in question, but if I open the form and have it just jump to a new record without filtering out the existing record, then CompanyName is populated with the name of the first company in the recordset, instead of the name of the company that I just entered.

So is there a way to have a button that I click that opens my entry form with everything but a blank new record filtered out?
 
How do I have a button open up a form that filters so that only a "New" record is used as the record source?

Set the data entry property of the form to true.

can't really follow the rest
 
Perfect! I changed the formopen line to this and all is great.

Code:
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormPropertySettings = DataEntry

Thanks.
 

Users who are viewing this thread

Back
Top Bottom