njmatt
asked on
Create New Record using Command button on Separate form
Problem: Unable to create new record.
Description: On "frmMain", I have "cmdAddNew" button (Caption : + Person). "cmdAddNew" should open up "frmProfile" and create a new record for editing. However, I keep getting the "You can't go to specified record" error.
IMED-Test.zip
Description: On "frmMain", I have "cmdAddNew" button (Caption : + Person). "cmdAddNew" should open up "frmProfile" and create a new record for editing. However, I keep getting the "You can't go to specified record" error.
IMED-Test.zip
ASKER
I posted the DB as well if you need to take a look.
Private Sub cmdAddNew_Click()
DoCmd.OpenForm "frmProfile"
DoCmd.GoToRecord , , acNewRec
End Sub
Quick fix:
Private Sub cmdAddNew_Click()
DoCmd.OpenForm "frmProfile"
On Error Resume Next '*** add this
DoCmd.GoToRecord , , acNewRec
Err.Clear '* add this
End Sub
Private Sub cmdAddNew_Click()
DoCmd.OpenForm "frmProfile"
On Error Resume Next '*** add this
DoCmd.GoToRecord , , acNewRec
Err.Clear '* add this
End Sub
ASKER
That gets rid of the error prompt, however does create a new record for editing.
I assume you mean does 'not' ?
On the form you are trying to open, check the Form's Allow Additions property - It should be set to Yes - and well as Allow Edits.
mx
On the form you are trying to open, check the Form's Allow Additions property - It should be set to Yes - and well as Allow Edits.
mx
ASKER
Thanks, yea I meant not. Yes, those settings are in place. I have gone through a handful of posts on this issue to no avail.
ok ... when the form opens, what DO you see ?
mx
mx
ASKER
It opens up "frmProfile" to the first record in the DB with all related data...The navigation selectors on the bottom are enabled, however the "New (blank) record" button is not enabled.
That would only happen if:
1) Allow Additions was NO ... or
2) The Form's RecordSource is not updateable.
Can you Compact & Repair (to shrink the size), then zip up the MDB, then attach the file for upload here (using the 'Attach File function below) ... removing any sensitive data of course? And please give a clear explanation of exactly how to reproduce the problem.
mx
1) Allow Additions was NO ... or
2) The Form's RecordSource is not updateable.
Can you Compact & Repair (to shrink the size), then zip up the MDB, then attach the file for upload here (using the 'Attach File function below) ... removing any sensitive data of course? And please give a clear explanation of exactly how to reproduce the problem.
mx
ASKER
I attached the file in my initial post.
Open "frmHome"
-> Click on "Employee Database"
-> Click on "+ Person"
-> This will bring you to the Profile form where I am unable to add a new record.
Thanks.
Open "frmHome"
-> Click on "Employee Database"
-> Click on "+ Person"
-> This will bring you to the Profile form where I am unable to add a new record.
Thanks.
Very strange. As long as frmMain is open, the nav add button is grayed out on frmProfile. IF you open frmProfile by itself, it's ok !
Trying to track this down.
mx
Trying to track this down.
mx
ASKER
Yea, I noticed that. It is very strange. I'm continuing my search for answers..I appreciate your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK ... I found the problem.
On form Main - property sheet - Data tab - Records Locks is set to ALL records. No can do. Set to No Locks ... here and everywhere.
mx
On form Main - property sheet - Data tab - Records Locks is set to ALL records. No can do. Set to No Locks ... here and everywhere.
mx
ASKER
Wow, always something simple like that. That does the trick. Thanks.
A bit unusual that would be set to All Records!
You are welcome.
mx
You are welcome.
mx
mx