Multiple filters and new record creation problem

  • Thread starter Thread starter JustALittleHelp
  • Start date Start date
J

JustALittleHelp

Hi there,

I've taken over a database with VBA that I'm only now learning.

I've disabled the navigation bar, but created a custom one to ensure the
Right Arrow no longer creates New Records. This workaround is successful when
navigation is record to record, but once the filters are applied, new records
get created once the end of the filtered list is reached.

Why doe this happen? Can it be fixed?

Thanks
 
I wish it were that easy. Unfortunately, I do need to be able to create new
records using the new record button. Please, any other suggestions? I'm about
to add 2nd and 3rd navigation bars specifically for each combo selection? Is
that possible?
Thanks again
M
 
OK, got an answer on this, in case it proves useful for another newbie who
doesn't know how to ask this question precisely.

Solution:

Add an OnOpen Event Procedure to the form properties:

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acLast
Me.AllowAdditions = False
End Sub

On whatever 'Add New Record' object you've built fur custom navigation (in
my case, the right arrow with asterisk), refer to a field that is mandatorily
updated for every record, i.e., in my case DateEntered field (a field that is
auto updated on entry), set Me.AllowAdditions = True on click, then once this
field has data set Me.AllowAdditions = False, refresh and reset focus thus:

Private Sub cmdNewRecord_Click()
On Error GoTo Err_cmdNewRecord_Click

Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me.DateEntered = Now()
Me.AllowAdditions = False
Refresh
Me.Region.SetFocus [Region is where the user in our
databaseneeds to start data entry next]

Exit_cmdNewRecord_Click:
Exit Sub

Err_cmdNewRecord_Click:
MsgBox Err.Description
Resume Exit_cmdNewRecord_Click

End Sub

Hope this helps someone else.
Michele
 
Back
Top