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:
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?
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?