Access 2003 - acNewRec Not Working

  • Thread starter Thread starter Mike Thomas
  • Start date Start date
M

Mike Thomas

In Access 2003, I am trying to add a new record in a bound form as follows:

lngKey = Me.txtFRPK

strNewNumber = InputBox("Please Enter Invoice #:", "NEW INV NUMBER")

If Len(Trim(strNewNumber)) > 0 Then

DoCmd.GoToRecord , , acNewRec
Me.Refresh

Me.txt_FRINumber = strNewNumber
Me.txt_DateOpened = Date
Me.txt_FRINumber.SetFocus

MsgBox "Old " & Str(lngKey) & " NEW " & Str(Me.txtFRPK)
End if

This works OK when run as an MDB, but when I convert it to an MDE, the
record is no longer added. The 3 text boxes are updated, changing the
values in the record we were on when the acNewRec was called.

The msgbox is showing the primary key of the current record before and after
the call. It is the same in both cases.

Does anyone know what could be causing this? Is there a more foolproof way
to add a record?

Many thanks,
Mike Thomas
 
The form may not be able to go to the new record, or the value entered in
the list box might not be a number.

Try something like this:

If IsNumeric(strNewNumber) Then
If Me.Dirty Then
Me.Dirty = False
End If
RunCommand acCmdRecordsGotoNew
...
 
Try taking out the Refresh. I can't say this will work, but nothing else
there looks suspect.
 
Back
Top